Vectorise all the things

Lately I’ve been working on some educational kits that I’m hoping to release soon. One important element for me is to be able to brand the products up so people know the kits are authentic circuitbeard. Originally I was just going to raster etch them, however this takes way too much time, so today I spent a bit of time creating vector versions of my logos to speed things up.

Laser cut logos

With the new vector versions, it now takes just seconds to brand an item, rather than minutes. It may not sound like much, but when you are talking about creating lots of kits, every saving is a worth while saving (I’ve been learning this lesson a lot lately).

Spark Core Cheat Sheet

Having recently been working on a IoT workshop based around the Spark Core from Spark Devices (more on this later), I really wanted a nice and simple way for the attendees to have instant access to all the core commands the Spark is capable of. There are already a plethora of cheat sheets available for various other platforms, however with the Spark Core being so new, there wasn’t anything out there yet, so I thought I’d go ahead an make one myself.

Here then is my cheat sheet for the Spark Core. I hope it comes in handy for people (and do let me know if you see any errors in it).

Spark Core Cheat Sheet

Useful Raspberry Pi Commands

Getting starting with the Raspberry Pi command line can be a steep learning curve, with a whole heap of commands at your fingertips it’s hard to remember them all. Here then are a bunch of commands I use quite frequently.

BEING SUPER

A lot of the time you’ll probably need to run commands as a super user, so to do this you’ll want to prefix your command with the keyword “sudo”

sudo mycommand # Executes mycommand with super user permissions

UPDATING/UPGRADING

As with any computer, it’s best to keep the system/packages installed on it up to date. This is done on the Raspberry Pi with 2 commands “update” and “upgrade”, where update syncs the internal database of available packages, and upgrade applies any updates.

sudo apt-get update # Syncronizes the package database
sudo apt-get upgrade # Upgrades installed packages inline with updated package database

MOVING AROUND

Once you are logged in to your Raspberry Pi you are probably going to want to navigate around the files/directories on it.

LS – Listing files/directories

ls # List the contents of the current directory

CD – Changing directory

cd Desktop # Move into a folder called Desktop inside my current location
cd /Desktop #  Move into a folder called Desktop located at the root of my device
cd ~/Desktop # Move into a folder called Desktop located in the home folder of the current user
cd .. # Move into the parent folder of my current location

PWD – Ouput the current working directory

pwd # Prints out the path of the current working directory

WORKING WITH FILES

Now that you can get around, you’ll probably want to be able to actually do something with those files.

MKDIR – Make a directory

mkdir myDir # Created a new directory named myDir inside the current working directory

RMDIR – Remove empty directories

rmdir oldDir # Removes the directory oldDir only if the folder is empty

RM – Remove a file

rm myFile.txt # Removes the file myFile.txt

CP – Copy a file/directory

cp oldFile.txt newFile.txt # Copies oldFile.txt into a new file named newFile.txt
cp oldFile.txt ~/tmp # Copies oldFile.txt into the ~/tmp directory
cp -r ~/tmp1 ~/tmp2 # Recursively copies files from ~/tmp1 into ~/tmp2

MV – Move a file/directory (TIP: Also handy for renaming files)

mv oldFile.txt newFile.txt # Moves oldFile.txt to newFiles.txt, effectively renaming it
mv oldFile.txt ~/tmp # Moves oldFile.txt into the ~/tmp directory
mv ~/tmp1/myFolder ~/tmp2/myFolder # Moves the myFolder directory from ~/tmp1 to ~/tmp2

WGET – Get a file from the internet

sudo wget http://www.example.com/file.txt # Downloads file.txt to the current working directory

EDITING A FILE

There are many way that you can edit a file on your Raspberry Pi, but the easiest way is to probably use the nano command.

sudo nano myFile.txt # Opens myFile.txt in nano for editing

Once you are in nano, you’ll find yourself using the following commands quite frequently.

Ctrl+X # Exits nano (It will ask you if you want to save changes if changes have been made)
Ctrl+K # Cut the current line
Ctrl+U # Un-cut or pastes the previously cut line

RUNNING A PYTHON SCRIPT

If you are creating scripts to run on your Raspberry Pi, the likelihood is that you have written it in Python. To run your script, you’ll want to use the “python” command passing in the python script file name you want to run.

sudo python myScript.py # Runs the myScript.py python script

SHUTTING DOWN/REBOOTING (SAFELY)

When it comes to shutting down or rebooting your Pi (say after making some system changes) the temptation is to just disconnect/reconnect the power, however this can lead to some unexpected side effects (corrupted SD card being the primary one). To shutdown/reboot safely then, you’ll want to use one of the following commands.

sudo reboot # Reboots the Pi immediately
sudo shutdown -r now # Reboots the Pi immediately
sudo shutdown -r 10 # Reboots the Pi in 10 minutes from now
sudo halt # Shuts down the Pi immediately
sudo shutdown -h now # Shuts down the Pi immediately
sudo shutdown -h 10 # Shuts down the Pi in 10 minutes from now

I will be updating this list in future with any other commands I find myself executing on a regular basis, but for now, that should be more than enough to get you started.