Skip to content

Instantly share code, notes, and snippets.

View pikesley's full-sized avatar
💭
I fly cargo planes full of rubber dogshit out of Hong Kong

pikesley pikesley

💭
I fly cargo planes full of rubber dogshit out of Hong Kong
View GitHub Profile
@pikesley
pikesley / This worked for me
Created December 23, 2017 14:58
ffmpeg is juju
ffmpeg -pattern_type glob -i "*.JPG" -c:v libx264 -vf fps=25 -pix_fmt yuv420p ~/Desktop/out.mp4
@pikesley
pikesley / luther.py
Created December 15, 2017 16:49
Random Poetry Generator
#!/usr/bin/env python
import random
with open('/usr/share/dict/words') as f:
words = list(map(lambda x: x.strip(), list(f)))
structure = [5, 4, 5, 5, 1, 3]
@pikesley
pikesley / hypriot-wifi.sh
Created November 23, 2017 15:14
Run this as root to configure WiFi for Hypriot https://blog.hypriot.com/
#!/bin/bash
[ ${2} ] || ( echo "usage ${0} <SSID> <PSK>" && exit 1 )
echo -n "Writing /etc/wpa_supplicant/wpa_supplicant.conf... "
echo "network={
ssid=\"${1}\"
psk=\"${2}\"
}" > /etc/wpa_supplicant/wpa_supplicant.conf
echo "done"
@pikesley
pikesley / README.md
Last active July 15, 2017 11:06
Rescue your SoundCloud tracks

You need a client_id, but if you don't already have one you might be shit out of luck because 'register a new app' now presents you with a Google Form and the message ***Please allow up to a month to receive an update on the outcome of your application*** ¯\_(ツ)_/¯

gem install httparty
gem install soundcloud

Fill in the client_id and your username, then run it. It will only download tracks that you've already marked as downloadable because who has time to mess with Oauth?

@pikesley
pikesley / say-the-swears.sh
Last active May 19, 2017 12:16
Swears on a Mac
curl https://raw.githubusercontent.com/peterkwells/uk-attitudes-to-offensive-language-and-gestures-data/gh-pages/data/list-of-swearwords-and-offensive-gestures.csv | tr -s '\015' '\n' | grep -v UID | cut -d ',' -f 2 | say
# old version below, now broken because Peter changed something - this will read the source of the 404
#curl https://peterkwells.github.io/known-uk-swearwords/data/swearwords.csv | tr -s '\015' '\n' | grep -v UID | cut -d ',' -f 1,2 | sed "s:\(.*\),\(.*\):number \1, \2,:" | say
@pikesley
pikesley / time-fix
Created January 30, 2017 09:43
Fix wandering Docker datetime
docker-compose run terraform date --set `date +%m%d%H%M`
@pikesley
pikesley / main.cpp
Created January 18, 2017 18:30
Neopixel Jewel
// Low power NeoPixel goggles example. Makes a nice blinky display
// with just a few LEDs on at any time.
#include <FastLED.h>
#define RING_LEDS 7
#define RING_PIN 6
CRGB ring[RING_LEDS];
@pikesley
pikesley / README.md
Last active December 7, 2016 14:30
I heard you wanted to misuse JavaScript testing frameworks in order to take screengrabs of your Reveal.js presentation

I have a presentation built in Reveal.js but I was asked to provide my slides as screengrabs, so I came up with this. It's hacky as fuck, but it solves the problem in a repeatable way. (Note: this works on my computer, your mileage will almost certainly vary)

This presumes that your presentation lives at presentation/index.html (relative to where you're running all of this from) and is available at http://localhost:4000/presentation/ (i.e. via Jekyll). Then, from (possibly flaky) memory:

  • brew install selenium-server-standalone
  • brew install chromedriver
  • npm install nightwatch

Copy the Rakefile (or copy the contents of my one into your existing Rakefile), copy the *js files into _nightwatch/, then run

  • rake screenshots
@pikesley
pikesley / clownstick.sh
Created December 1, 2016 10:16
Make your computer read Donald Trump's favourite insults
CSV=https://cooleyb.github.io/trump-s-favourite-insults-on-twitter/data/trump-s-favourite-insults-on-twitter.csv ; curl ${CSV} | tr -s '\015' '\n' | grep -v UID | cut -d ',' -f 1,2 | sed "s:\(.*\),\(.*\):\2,:" | say -v Alex
@pikesley
pikesley / .env
Last active November 17, 2016 21:45
USERNAME: fish
PASSWORD: forgotaboutdre