I moved my stuff!
I've started keeping track of my notes in a new place!
If you're interested, check it out at docs.juliaebert.com.
taylor price

Product Placement

pixel skylines
h

祝日 / Permanent Vacation
No title available

titsay
almost home
Alisa U Zemlji Chuda
Sweet Seals For You, Always
DEAR READER
let's talk about Bridgerton tea, my ask is open

Discoholic 🪩
🪼
NASA
Sade Olutola
Misplaced Lens Cap
Stranger Things
Three Goblin Art

❣ Chile in a Photography ❣
seen from United States
seen from United States

seen from Italy

seen from Spain

seen from Türkiye
seen from United States

seen from United States
seen from Indonesia
seen from Italy
seen from Germany

seen from Indonesia
seen from United Kingdom

seen from United States
seen from Germany

seen from United States
seen from United States
seen from Türkiye
seen from Brazil

seen from United States
seen from United States
@pterencephalon
I moved my stuff!
I've started keeping track of my notes in a new place!
If you're interested, check it out at docs.juliaebert.com.
Setting up an extra internal drive (on Linux, of course)
Format your drive
I use gparted and set the whole thing to be a single ext4 partition with a gpt partition table. Note the partition ID (e.g., /dev/sda1) for the next step.
If you give your partition a label and name in this step, it'll make it easier to identify/remember in the next step and later on. Setting the name will also mean it's nicely labeled in your file explorer.
Get the UUID of the disk
Run sudo blkid and copy the UUID for the partition from the previous step.
Create a mount point
Choose a location where you want your drive to show up as, such as /data, /media/data, or /media/USERNAME/data. I don't actually know if there's a canonical way to choose the mount point. Since I'm generally creating a drive that's only used by my user, I generally create the mount point under my username.
Now create this directory to mount at, such as: (with your username filled in)
sudo mkdir /media/USERNAME/data
Then change this location to be owned by your user and group:
sudo chown -R USERNAME:USERNAME /media/USERNAME/data
Set up automatic mounting
We'll add an entry to the filesystem table to detect and mount the drive by its UUID when the computer boots, and give your user read and write access to the drive.
WARNING: If you mess up this file, your computer will possibly not boot. I suggest making a backup of it so you can revert if necessary.
Edit /etc/fstab:
sudo nano /etc/fstab
Add a line to the end of the file, using the UUID you got before:
UUID=YOURUUID /media/USERNAME/data ext4 user=USERNAME,rw 0 2
A couple notes on this:
Don't put quotes around the UUID
The second entry is the mount point you set up in the previous step
ext4 is the journaling system you formatted your partition as. I think you can also use auto, but why not be explicit if we know it? Also, if you set this wrong there's a possibility your computer won't boot.
The user= and rw options specify that it will be mounted for your user with read/write permissions. (I don't really know much about all the configurations here. Check out the Ubuntu documentation wiki for more info about this and fstab in general.)
0 is the "dump" flag. It's not used for much and has something to do with automatic backups. When it doubt, it's 0.
2 is the "pass". It means that fsck (filesystem check) will check this as a secondary partition. 0 means it will be skipped (common for external drives) and 1 will be checked first (usually used by your root partition).
Check
Try manually mounting the drive:
sudo mount /dev/sda1 /media/USERNAME/data
Verify that it shows up in your terminal and file explorer and create a test file. (Checks that you can write as your user.)
And unmounting it:
sudo umount /media/USERNAME/data
Check that your test file isn't in the mount location. Remount and check that it is. (aka check that you actually wrote to the disk.)
Then reboot (verify that you didn't break fstab) and check that your drive mounted properly and your test file is there.
Sources: Installing a New Hard Drive, fstab
Updating Node
Ubuntu comes with an old version of Node.js and it's a pain in the ass to update and make it use the updated version. Node version manager (nvm) worked for me.
Install nvm:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
In a node terminal/tab, list Node versions:
nvm ls-remote
Install one of the versions, e.g.:
nvm install v10.9.0
Check that it's now using the new version:
node -v
Source: Ask Ubuntu
When “apt-get” fails in Chrome OS
I started getting a segfault when I try to run any apt or apt-get commands in crouton on my Chromebook. So I couldn't update or install. This Github issue comment provided a workaround. It's not pretty, but it works. Basically, you manually download and re-install apt, then update and install dependencies.
Create a Linux Desktop Entry for Eagle
Eagle is self-contained to a folder when you download and unpack, which is convenient for some things. But mostly not. I want to be able to open it like any other program.
Unpack the downloaded tar.gz file to ~/.local/share/Eagle/. You should now have a subfolder named something like eagle-<VERSION>/
Create a file called eagle.desktop in ~/.local/share/applications/ containing the following:
[Desktop Entry] Name=Eagle Type=Application Exec=/home/<USERNAME>/.local/share/Eagle/eagle-<VERSION>/eagle Terminal=false Icon=/home/<USERNAME>/.local/share/Eagle/eagle-<VERSION>/bin/eagle-logo.png Version=<VERSION> Categories=Development
Where VERSION is the Eagle version number (like 8.6.3) and <USERNAME> is your username. If you're using a theme that has an icon for Eagle, you can replace the Icon value with the name given to that icon.
Whenever you get a new version of Eagle, you'll have to update the version number in this .desktop file to point to the right location.
Check if computer restart required, with a bash alias
Sometimes you have to restart Linux after updates. If you do this with the software updater, it will tell you a restart is required. But I do my updates through the command line and am generally too lazy to restart my computer on a regular basis.
You can tell that a restart is required if the file /var/run/reboot-required exists. But I also never remember what that file name and location are to check that. But I can remember rr, so now I have an alias that uses that file to tell me if a restart is required based on the existence of that file. (This came from the AskUbuntu answer.)
Just add the following to your ~/.bashrc file:
alias rr='if [ -f /var/run/reboot-required ]; then echo "reboot required"; else echo "No reboot needed"; fi`
Installing JetBrains IDEs in Linux
Installing
JetBrains makes nice IDEs for a bunch of languages (for us mere mortals who don't use vim or emacs). But they don't make installing on Linux super easy. Here's how I do it.
Download the relevant program and version from the JetBrains website (it's a .tar.gz file)
Extract the folder inside to ~/.local/share/JetBrains/
cd into the bin folder: ~/.local/share/JetBrains/<program>-<version>/bin
Run the launch script from the command line (something like ./pycharm.sh)
When the program opens, click Tools > Create Desktop Entry. You can either make it user-specific or global.
Updating
If you're installing an update, follow the same steps. Creating a new desktop entry should overwrite the old one, but you may need to restart your session for it to take effect. (For me in Gnome, that's Alt+F2, then r). Also note that if you have a user-specific desktop entry, that will take precedence over a system-wide one.
Changing the Icon
By default, the created desktop file will use the icon in the installation folder. That means it will probably ignore an icon set by a theme (if you're using one). You'll have to do this after you create a new desktop file from updates as well.
Open the desktop file (probably ~/.local/share/applications/jetbrains-<program>.desktop for user-specific or /usr/local/share/applications/jetbrains-<program>.desktop for system-wide)
In the line that says Icon= change it to just the program name -- e.g., Icon=pycharm and restart your session.
Command Line History Completion
In Matlab, you can start typing a command, hit the up arrow, and it'll go through the history of commands that match what you've typed in. I like this feature and want to use it in my general command line.
Turns out this is easy to do in Linux. Open the .inputrc file:
nano ~/.inputrc
Add this to the file:
## arrow up "\e[A":history-search-backward ## arrow down "\e[B":history-search-forward
Save and exit, then load the changes:
bind -f ~/.inputrc
Force Matlab to make nice SVGs
Sometimes Matlab decides that the figure you're trying to export is too complicated for proper SVG exporting. When you go to export the figure with saveas, it creates an SVG with embedded images instead of vector graphics. (This is all in Matlab 2014b and later, with its new graphics system.) After digging through Google results and documentation, there is a solution to force it to export as a vector image (from the saveas documentation):
Set the renderer for your figure to 'painter':
fig = figure; fig.Renderer = 'painter';
Then save the figure as normal:
saveas(fig, 'my_figure.svg');
And you'll have a proper vector plot.
Chrome OS tricks & bits
Setting up xiwi
Add it to an existing crouton installation: sudo sh ~/Downloads/crouton -u -t xiwi
Install the Chrome extension
Inherit your XFCE settings by adding this line to your user's .xiwirc file (this file might not exist yet): xfsettingsd&
Run graphical Crouton/chroot
In a totally separate view:
sudo startxfce4 -X xorg
Use Ctrl + Alt + Shift + ← and Ctrl + Alt + Shift + → to switch between Chrome OS and Linux.
In a tab/window within Chrome OS:
This requires that you have xiwi installed as part of your crouton setup and the crouton integration extension installed in Chrome.
sudo startxfce4 -X xiwi
(from Crouton Wiki
Run Crouton/chroot shell
This gives you a full linux shell that you can run programs from and install things with apt
Get the names of your chroots:
sudo edit-chroot -a
Mount the chroot and enter the shell: (using whatever chrootname you got from the first command).
sudo enter-chroot -n chrootname
If you have a single chroot, you should be able to just do sudo enter-chroot.
(from Crouton Command Cheat Sheet)
Run a single linux program in a window (already in a chroot shell)
xiwi [program-name]
Some programs require an additional flag to run properly, such as Sublime text editor: xiwi subl -w
Remount a card/drive with execute permissions
I ran into this when trying to run scripts that were stored on my Chromebook's SD card.
sudo mount -o remount,exec /media/removable/Card
(or wherever the mountpoint of your card/USB device is)
(from Unix StackExchange)
Set locales
To be minimalistic, locales are not set by default in Chrome OS/crouton. This can cause a problem with filenames or characters not displaying in terminals (or terminals crashing). You can set the locales to stop the madness.
sudo locale-gen en_US sudo locale-gen en_US.utf8 sudo dpkg-reconfigure locales
(First select all, then next select the default as en_US)
It should be reconfigured on reboot
Shiny Matlab Figures: Exporting
So far in our quest to make better Matlab figures, we've looked at an alternative way to draw error bars and adjusting parameters to make figures more readable. Last (for now) but not least: how to best get those figures out of Matlab and into the real world. There are some built-in methods, but I've found they don't work quite as well as an alternative from the Matlab File Exchange.
A note on all of these: The figures were exported without resizing the figure window, which is how I make my figures unless I have a compelling reason to change the aspect ratio or size. If you scale the window size, your lines and fonts will be smaller relative to the graph.
PNG
The simplest method is to directly save the figure as a PNG file with the save button or command line. (Note: never use JPEG for graphics like this. JPEGs are compressed and the edges and borders in the image will look bad). This is the result:
You'll notice, though, that the edges and text look somewhat choppy because the output has no anti-aliasing. Also, sometimes the x-axis label is cut off, as happened here. And last but not least, you can't do any refinements or editing of the image after it's created.
EPS
The next option is to save the figure in an editable vector format. Matlab will let you directly save EPS files for this purpose. Here's the result if we save as EPS, then open the file in Inkscape (for editing) and export as a PNG from there:
This looks pretty much the same as the PNG, with the same problems! Why? Because EPS files don't support transparency and our figure includes a patch with transparency, Matlab exports the entire thing as a raster (pixel-based) image embedded in the EPS. So we've gained nothing. EPS works OK if you have a figure without transparency, but the files are a little strange (such as poor letter spacing) and hard to work with in my preferred, free vector editor of Inkscape.
SVG
Which brings us to the final and (in my opinion) best way to export images: plot2svg. It's available for download on the Matlab File Exchange. Simply download the file, add it to your path in Matlab, and call plot2svg. It will save the current figure as an SVG, which is a more advanced vector file format that supports things like transparency and is really easy to work with in Inkscape. Here's the result when exported as a PNG from Inkscape:
That's one shiny-looking graph. Making adjustments to the graph like fonts, labels, and combining graphs becomes really easy working with SVG files. Plus, you can do things like export them as PNGs of any size or export them as scalable PDFs to embed in a document.
The worst "export" of a Matlab graph I've seen was a screen capture of the Matlab window copied and pasted onto a poster. Now you can feel snooty about how ridiculously awesome your figures look in comparison.
Shiny Matlab Figures: Sizing and Parameters
In my never-ending quest to create decent-looking graphs with Matlab, one challenge is the default parameters for figures, particularly in terms of font size and line thickness. These defaults look alright for looking at the figures yourself to figure out what's going on. But if you want to export them to use in a presentation, poster, or paper, the lines are too thin and the fonts too small. Using the same data generation as in my previous post, it looks something like this:
That comes from this little bit of Matlab code:
% Plotting with default settings legend_labels = {'Square Root Growth', 'Linear Growth'}; figure hold on title('Plot with default values') xlabel('Percent Complete') ylabel('Arbitrary Values') plot(x_vals, data_mean, 'b') plot(x_vals, data2_mean, 'r') legend(legend_labels)
I mean, that figure doesn't look bad, but this looks a lot slicker:
There are a few modifications to the defaults I've figured out along the way to come to this, so that this figure comes from:
% Graphically refined plotting font_size = 16; title_size = 20; legend_labels = {'Square Root Growth', 'Linear Growth'}; figure set(gca, 'Box', 'off', ... % Remove outline for top/right of graph 'FontSize', font_size, ... % Set size of tick and axis labels 'LineWidth', 2) % Set width of axes to 2 hold on title('Graphically refined plotting', 'FontSize', title_size, 'FontWeight', 'bold') xlabel('Percent Complete', 'FontWeight', 'Bold') ylabel('Arbitrary Values', 'FontWeight', 'Bold') plot(x_vals, data_mean, 'b', 'LineWidth', 2) plot(x_vals, data2_mean, 'r', 'LineWidth', 2) legend(legend_labels, 'Location', 'NorthWest') legend('boxoff')
Let's go through each of the pieces here.
Font sizes: By setting variables for the title and font sizes, it's easier to make them consistent (and modify them) for multiple figures produced in a file. I've found 16 and 20 pt fonts to work well.
set(gca, ...): This sets a couple of parameters for the current set of axes. The 'Box' ensures that there no lines are placed on the top and right sides of the figure. Without this, they'll show up in some (but not all!) figures. I think it looks nicer without them. 'FontSize' makes use of the variable set above to change the size of text for axes labels and legends. Setting the 'LineWidth' will make the axes and tick marks thicker, but doesn't set the thickness of the lines in the plots.
Title and Labels: Here you manually set the size of the title and make the labels bold. It just makes things stand out better.
'LineWidth': You have to manually set the line thickness for every plot you make.
Legend: In the first figure, the legend hid part of the data. However, legends can be re-positioned (take a look at 'Location' in the legend properties documentation). I also got rid of the box (and background) of the legend, which I think just looks ugly.
Just like with plotting the error bars as patches, this takes a little more work and code. The result once again, though, is much nicer-looking, professional graphs that are much easier for your audience to actually read.
Shiny Matlab Figures: Drawing Error with Patches
I make a lot of Matlab figures. That's an occupational hazard of being the undergraduate in a research lab, I suppose. Over the past few years, though, the graphically-conscious side of me has gotten annoyed at the terrible Matlab figures I've seen on posters and even in papers. I have also come up with my own tricks to create really gorgeous Matlab figures. Over the next few posts, I'll share a couple of them with you, including:
Plotting error with patches instead of error bars
Changing default figure drawing parameters and sizing
Exporting figures
Let's start with the first one: error bars. Error bars are great when you have a few data points, but when you have more continuous data, it gets messy and hard to tell what's going on, like this:
This is created using a pretty simple script in Matlab. The data is generated pseudo-randomly:
% Generate pseudo-random data num_data_points = 25; data = rand(10, num_data_points); for i=1:size(data, 2) data(:,i) = data(:,i)*i^.5; end % x values x_max = 100; % Calculate mean and standard deviation of data data_mean = mean(data,1); data_std = std(data,0,1);
Then it's plotted with a few lines of code using the errorbar function:
% Plotting error with errorbar figure errorbar(x_vals, data_mean, data_std, 'LineWidth', 2) title('Plot error with errorbar') xlim([0 x_max])
However, I've discovered that using the patch function in Matlab can create much more visually appealing and easier to interpret graphs like this:
This requires some additional code:
% Plotting error with patches figure hold on title('Plot error with patch') xlim([0 x_max]) % Loop the x values back to the start patch_x_vals = [x_vals, x_vals(end:-1:1)]; % Create the data+std and data-std values patch_data_std = [data_mean-data_std, data_mean(end:-1:1)+data_std(end:-1:1)]; plot(x_vals, data_mean, 'LineWidth', 2) patch(patch_x_vals, patch_data_std, [0 0 1], 'EdgeColor', 'None', 'FaceAlpha', 0.4);
The patch is drawn as a polygon, starting on the left with the lower bound, then reversing direction to draw the upper bound of the error from right to left. The arguments to patch after this specify the face color, edge color, and transparency.
This relatively minimal addition can make your plots much easier to read, particularly if you're dealing with multiple data sets at the same time where error bars would overlap and be nearly impossible to distinguish.
I am in constant search of something easy to serve as an external memory for everything I have to do and remember. A list on a piece of paper? Great until you misplace or forget the paper. An app? I thought I'd tried them all: ToDoist, Wunderlist, you name it. ToDoist is nice for individual tasks, but groups of things and notes to myself got complicated fast and I found that I wasn't actually using it. It did have cross-system support, so I could use it in Chrome and on my iPad and Android phone. That was the major shortfall of many other apps I tried: if I don't have my phone or computer, I still need my external memory.
Then I discovered that Google has its own feature, and I'm surprised that I had never heard of it: Google Keep. Since I am already fully integrated into the Google ecosystem, it fits fantastically with everything else I already use, too. Here's how it works:
Create Notes
You can make lists, checkbox lists, text, audio, or image notes to keep track of anything you need to. I have a grocery list, a list of things to do at work, and movies I want to watch, for example. These notes all show up on the keep website that you can drag to organize, recolor, and archive when you're done. Plus, you can add an image to any note. I'm not a fan of most of the colors for the notes (they're a bit bright for black text), but the whole thing uses Google's great new Material design and is really slick overall. When you're done, you can also archive notes instead of deleting them, in case you ever need to go back and check it in the future.
Share Notes
You can share notes. Now you can make blame your roommate for not picking up more milk.
Remind Yourself
You can also set reminders for your notes, by time or place, so you don't forget what to do when or where you need to do it.
See it Everywhere
One of the most useful features of Keep is that it has a nice web interface, Android app, and iOS app. Creating, organizing, and handling notes is straight forward in all of them without unnecessary distractions. Bonus: there's a widget for Android, too. Because it's all connected to your Google account, all of your notes are synced and instantly accessible anywhere you're logged into Google - no installation necessary.
Overall
Having some way to group or sort notes would be a great additional feature, but even without that it's a great tool. I'd also like to see integration with reminders in the new Inbox, but that might come with time. Overall, Google Keep is the most painless way I have found to keep my thoughts in control: full-featured without being overwhelming, free and ad-free, and effectively cross-platform.
DrRacket Tricks and Customization
My first programming class used DrRacket, and I have kept using it for the past three years as a tutor for that class, and now as a TA. Along the way, I've learned a bunch of tricks about DrRacket that can make programming in it easier and much more enjoyable.
Customize the color scheme to something you like. I explain how to get a bunch of options in this post
Go to Edit > Preferences > Editing > General and check the box for "Enable automatic parentheses." It automatically closes your parentheses and makes your life a lot easier.
In the same tab, also check "Show line numbers"
Instead of writing out lambda all the time, you can use a keyboard shortcut to get the character λ. It's Ctrl + \.
Fix code indentation for a section by highlighting it and pressing Tab.
Fix indentation for your entire file with Ctrl + I.
You can right click on any function name to search for it in the help desk.
You can change the default browser for opening documentation under Edit > Preferences > Browser.
To prevent a zillion windows from opening, go to Edit > Preferences > General and check "Open files in separate tabs"
When working with large programs the program contour is nice for navigating within the file. Turn it on with View > Show Program Contour or with Ctrl + U.
You can change the position of the Interactions area (below vs. to the right of the Definitions area) with View > Use Horizontal Layout.
How to make DrRacket more pleasant-looking
DrRacket's default color scheme isn't pretty, and there aren't a lot of alternatives included. Luckily, some programmer before you decided to fix that instead of writing whatever code they were actually supposed to be working on. The result is 54 different color schemes for DrRacket (27 each of dark and light) which can be found here. It's also really easy to install - you don't even have to download anything separately. Just fire up a terminal and run:
raco pkg install git://github.com/tuirgin/base16-drracket
When you restart DrRacket and go to Edit > Preferences, the themes should all show up in the Colors tab.
I'm currently using one of my favorite themes, Monokai Dark, with the slight modification of setting the "Basic gray parenthesis highlight color" to #3E3D32 (slightly darker than the default).
Now you have one less excuse to not be doing your programming homework.
How to "Send Mail As" with Gmail's recent update
It used to be super easy to set Gmail to send mail as another email address. It recently (as in, this month) became a lot harder, since Gmail now doesn't let you automatically use its SMTP servers. If that last sentence didn't make sense, don't worry. I'll walk you through how to set it up step by step. To start out, I assume that you already have email forwarding set up so that your custom email (say, [email protected]) gets sent to your gmail (which we'll call [email protected]).
You must have 2-step authentication set up for you Google account. If not, when you try to log in later, you'll get an authentication failure, and then an email about a suspicious log in attempt.
Once you have 2-step authentication set up, you need a specific app password that you'll use for setting up the email sending.From any Google page, click on your user picture in upper right corner and select Account. From the Account page, select the Security tab. In the Password box, click Settings next to App Passwords. On the dropdown menu that says Select app, choose Other (custom name). Type in any name you like (I went with Gmail SMTP) and click Generate. Copy the new password.
Now we can actually set this up! From your Gmail page, click the cog icon on the right side and select Settings. Go to the Accounts and Imports tab. In the Send mail as section, click Add another email address you own. In the window that pops up, put in the email address you want to send as ([email protected]) and click Next Step. (Go ahead and change the name and alias settings however you want.) On the next page, enter the information as follows:
SMTP Server: smtp.gmail.com
Port: 465
Username: Your full gmail address, like [email protected]
Password: The password you generated and copied in Step 2
Secured Connection ussing SSL (Change the radio button to select this option)
Then click Add Account. An email should show up in your inbox, which you can click to verify the email address. Now, if you go to Accounts and Import in your settings, you should see the new email address.
That's more of a pain than it used to be, and more than it should be, but it is still possible to send email from Gmail using your own custom email address.
Source: A helpful post on Google Product Forums