View rpsls.md
  • Scissors cut Paper

  • Paper covers Rock

  • Rock crushes Lizard

  • Lizard poisons Spock

  • Spock smashes Scissors

  • Scissors decapitate Lizard

  • Lizard eats Paper

  • Paper disproves Spock

View accellerologger.ino
#include <SparkFun_ADXL345.h>
#include <SD.h>
#include <SPI.h>
//ADXL345 adxl = ADXL345(10); For SPI Cumunication
ADXL345 adxl = ADXL345();
File myFile;
const int threshold = 1499;
const int switchPin = 7;
int switchState;
View copy-mc-saves.md

Steps for copying Minecraft saves to a PC

(There's more of this Gist than will fit in the preview. Click on it to see the whole thing)

First, open, play and then quit Minecraft at least once; to make a .minecraft appdata folder)

  1. Open Windows Explorer (press Win+R, then type explorer)
  2. Go to the %appdata% directory. There should be a folder called .minecraft listed
  3. Open the .minecraft folder. There should be a saves folder in it.
View appdata.md

Need to take %APPDATA% directory data to another PC? For example Minecraft game saves to take in to a school for projects, or to a friend's house. The tricky part is: %APPDATA% has a different location depending on the version of Windows. Yay Microsoft, thanks once again.

The good news is that many Windows programs do use the environment variable to locate this folder, so you can just override it and launch your game or whatever from a .cmd / .bat file.

In the case of Minecraft on a USB:

  1. Make a folder structure on the USB drive for it (assume E: is the USB):
    • E:\Minecraft
    • E:\Minecraft\bin
    • E:\Minecraft\data
View count-cpus.md

I was using this pipeline:

grep -c processor /proc/cpuinfo

However there's a better way: nproc

and for a good summary of CPU info from /sys and /proc/cpuinfo use lscpu which has options to produce parseable output for pipelines.

View unixdates.md

Convert a Unix timestamp into human-readable format:

  • GNU: date -date='@1501768813'
  • BSD: date -r 1501768813

Convert the other way

  • Current date/time as Unix timestamp: date +%s

  • A specific date/time (assumes current timezone):

View check-required-utilities.sh
# required utilities
required=(
grep
awk
curl
jq
)
missing=()
View sources.sh
base=$(cd -- "$(dirname -- "$0")"; pwd -P)
source $base/util/platform.sh
source $base/util/check-required-utilities.sh
View fix-id3s.py
# I used this code within an IPython session to clean up all the missing ID3 tags from my MP3 collection.
# They had gone missing years ago when I down-sampled them to fit on an old phone, and then lost the originals.
# Fortunately I named the files themselves with the basic details (artist, date, title and so on) so it was possible to
# recover the tags... It sat on my to-do list for *years* but now I finally did it.
# I used the Python library "EyeD3" (get it?): https://pypi.python.org/pypi/eyeD3
# This requires Python 2.7, which has some interesting quirks for Unicode, a bit of a pain since I had named my MP3s
# with utf8 characters. What I've come up with *mostly* works. When it doesn't I had to resort to manually editing (using
# Clementine).