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).
View makeQR.py
#!/usr/bin/env python
# usage: echo "My QR Text"|makeQR.py > myqr.png
# see http://alecthegeek.github.io/2013/04/28/creating-qr-codes-on-python.html
import sys
import qrcode
qrcode.make("".join(sys.stdin.readlines())).save("/dev/stdout","png")
View SICP.md

I found the SICP available for Emacs in the MELPA. It's a conversion of the HTML version made available for free by MIT, into Texi and then generated into Info.

The source for the MELPA is available on github: https://github.com/webframp/sicp-info

There was one open Issue: https://github.com/webframp/sicp-info/issues/2 so I forked the master repo and created a PR from the correction to that, plus regenerating the whole Info as this appears not to have been done in 4 years.

Hopefully my PR will get accepted. If not, then I can still use my own fork, I'll just have to learn how to install a local package with Spacemacs, which I think isn't too hard.

View sticks.py
import pygame, random
pygame.init();
scr=pygame.display.set_mode([640,400])
df=pygame.display.flip; rnd=random.randrange; draw=pygame.draw
scr.fill([0,0,255]); df()
while True:
draw.aaline(scr, [rnd(255),rnd(255),rnd(255)],
[rnd(640),rnd(400)],
[rnd(640),rnd(400)]); df()
View sticks.bas
5 REM This is for Amstrad CPC Locomotive BASIC
10 CLS
20 WHILE 1>0
30 GRAPHICS PEN 15*RND
40 MOVE 640*RND,400*RND
50 DRAW 640*RND,400*RND
60 WEND
View rotate-display.scpt
-- Now works with Mountain Lion 10.8
-- Rotate Display on machines
-- This code is offered without any liability implied or explicit.
-- Use it at your own risk.
-- Copyright 2005, 2006 Conrad Albrecht-Buehler
-- Modifications for portrait/landscape only May 2006 Bryan Wu to support toggling between only two modes - landscape and portrait
-- NOTE: UI Scripting must be enabled for this to work! Confirm that
-- "Enable access for assistive devices" is checked in the