Skip to content

Instantly share code, notes, and snippets.

View callumj's full-sized avatar
🙌
writing code

Callum Jones callumj

🙌
writing code
View GitHub Profile
@callumj
callumj / Dockerfile
Created March 11, 2014 02:02
Example Dockerfile for Ruby app (with Bundler + Git clone)
FROM ubuntu
MAINTAINER Callum Jones <callum@callumj.com>
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get -y update
# prep for downloading and installing ruby
RUN mkdir -p /temp/ruby
RUN apt-get install -y build-essential libssl-dev zlib1g-dev
@callumj
callumj / extracted.m
Created February 12, 2014 10:12
MPNowPlayingInfoCenter setting
- (void)reflectNowPlaying
{
if (_activeTrack == nil)
return;
NSMutableDictionary *activeInfo = [[NSMutableDictionary alloc] initWithDictionary:[[MPNowPlayingInfoCenter defaultCenter] nowPlayingInfo]];
if (artworkNeedsReflecting || metaNeedsReflecting)
{
[activeInfo setObject:[_activeTrack title] forKey:MPMediaItemPropertyTitle];
@callumj
callumj / mysql-dump.sh
Last active December 25, 2015 08:19
tcpdump for MySQL - recording table modifications.
tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
if(/^(INSERT|UPDATE)/) {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$time = "$hour:$min";
if (defined $q) {
if ($q =~ /INSERT\s+INTO\s+`(\w+)`/) {
print "$time,insert,$1\n";
}
if ($q =~ /UPDATE\s+`(\w+)`/) {
--1be8c94f995d47bb81e298f853aba9c0
Content-Disposition: form-data; name="avatar"; filename="FSQ-Scr1.png"
Content-Type: image/png
âPNG

IHDRÄ¿í<8…tEXtSoftwareAdobe ImageReadyq…e<#iTXtXML:com.adobe.xmp<?xpacket begin="Ôªø" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.5-c014 79.151481, 2013/03/13-12:09:15 "> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmp:CreatorTool="Adobe Photoshop CC (Macintosh)" xmpMM:InstanceID="xmp.iid:CF015EF9F0FA11E297C097A1C70D0091" xmpMM:DocumentID="xmp.did:CF015EFAF0FA11E297C097A1C70D0091"> <xmpMM:DerivedFrom stRef:instanceID="xmp.iid:CF015EF7F0FA11E297C097A1C70D0091" stRef:documentID="xmp.did:CF015EF8F0FA11E297C097A1C70D0091"/> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end="r"?>f˙‘S PLTEfi
@callumj
callumj / csv_to_yml.rb
Created June 20, 2013 03:27
Generates YAML files from a directory of CSVs using libraries that know what they are doing.
require 'csv'
require 'yaml'
dir ||= ENV["CSV_DIR"]
Dir["#{dir}/*.csv"].each do |file|
set = []
fields = []
index = 0
http://placeme.azurewebsites.net/suburb/recommendation?responses%5BhousePrice%5D%5B%5D=1000000&responses%5BhousePrice%5D%5B%5D=1500000&responses%5Bage%5D%5B%5D=36&responses%5Bage%5D%5B%5D=45&responses%5BcloseToCity%5D=true&responses%5Bstate%5D=WA
// This is the main application configuration file. It is a Grunt
// configuration file, which you can learn more about here:
// https://github.com/cowboy/grunt/blob/master/docs/configuring.md
module.exports = function(grunt) {
grunt.initConfig({
// The lint task will run the build configuration and the application
// JavaScript through JSHint and report any errors. You can change the
// options for this task, by reading this:
@callumj
callumj / README.md
Created November 18, 2012 10:30
Use rtmpdump and ffmpeg to download BBC Radio 1 shows

This script will use the tools rtmpdump and ffmpeg to download and convert a BBC Radio 1 show into a m4a file.

It is capable of either downloading a show direct, or finding the latest show from a webpage.

Requirements

  • nokogiri (Ruby gem)
  • rtmpdump (binary)
  • ffmpeg (binary)
@callumj
callumj / .my53.yml
Created July 24, 2012 14:39
Set Route 53 record from local IP
options:
only_if: "192[.]168[.]4[.].*"
base:
host: callum
domain: office.example.net
aws:
resource_id: SSS2222222
access_key_id: SSSSSS44444444
secret_access_key: "DSFKJNDS+++SSSSS2222222SDDS"
@callumj
callumj / ec2_hostname.rb
Created July 12, 2012 01:33
Set hostname from EC2 Tags (Name, Domain)
#!/usr/bin/env ruby
require 'net/http'
require 'open-uri'
require 'uri'
require 'base64'
require 'openssl'
require 'cgi'
def query_aws(host, path, action, params = {}, method = "GET")