Skip to content

Instantly share code, notes, and snippets.

View adamvr's full-sized avatar

Adam Rudd adamvr

  • Cologne, Germany
View GitHub Profile
@adamvr
adamvr / client_test.js
Last active September 25, 2022 04:13
Tests for mqtt.js against mosquitto
var mqtt = require('mqtt');
mqtt.createConnection(1883, 'localhost', function(err, client) {
if (err) {
console.dir(err);
return process.exit(-1);
}
var events = ['connack', 'puback', 'pubrec', 'pubcomp'];
@adamvr
adamvr / config_files.rb
Created July 16, 2012 13:55
Initializer for config files
::APP_CONFIG = {}
ignore = [:database]
Path.glob("#{Rails.root}/config/*.yml") do |f|
key = File.basename(f, '.yml').to_sym
content = YAML.load_file(f)[Rails.env]
::APP_CONFIG[file] = content unless ignore.include? key
end
@adamvr
adamvr / include_gmt_offset.patch
Created July 19, 2012 08:25
active_paypal_adaptive_payment patches
301,302c301,302
< x.endingDate opts[:end_date].strftime("%Y-%m-%dT%H:%M:%S")
< x.startingDate opts[:start_date].strftime("%Y-%m-%dT%H:%M:%S")
---
> x.endingDate opts[:end_date].strftime
> x.startingDate opts[:start_date].strftime
node_modules
@adamvr
adamvr / message.txt
Created July 23, 2012 02:57
Paperclip postinstall message
Post-install message from paperclip
# NOTE FOR UPGRADING FROM PRE-3.0 VERSION #
##################################################
Paperclip 3.0 introduces a non-backward compatible change in your attachment
path. This will help to prevent attachment name clashes when you have
multiple attachments with the same name. If you didn't alter your
attachment's path and are using Paperclip's default, you'll have to add
`:path` and `:url` to your `has_attached_file` definition. For example:
has_attached_file :avatar,
:path => ":rails_root/public/system/:attachment/:id/:style/:filename",
@adamvr
adamvr / .gitignore
Created July 24, 2012 01:20
HTTP Agent and request logger
node_modules
@adamvr
adamvr / README.md
Created July 26, 2012 03:14
Openwrt scripts

Openwrt scripts

A couple of scripts for publishing the state of an openwrt router to mqtt.

Relies on mosquitto_pub and mosquitto_sub being present

init

Init.d scripts including one to start a pair of file monitors and one to publish whether or not the router is onlien

java -Xms512m -Xmx1024m -cp "~/Library/Application Support/minecraft/bin/*" -Djava.library.path="bin/natives" net.minecraft.client.Minecraft "ohpenis"
@adamvr
adamvr / brew_install_bad.log
Created August 21, 2012 08:24
Problems with compiling gdbm and zsh through linux homebrew
==> Installing zsh dependency: gdbm
==> Downloading http://ftpmirror.gnu.org/gdbm/gdbm-1.10.tar.gz
File already downloaded in /home/adam/.homebrew/cache
/bin/tar xf /home/adam/.homebrew/cache/gdbm-1.10.tar.gz
==> ./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/gdbm/1.10 --mandir=/usr/local/Cellar/gdbm/1.10/share/man --infodir=/usr/local/Cellar/gdbm/1.10/share/info --enable-shared
./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/gdbm/1.10 --mandir=/usr/local/Cellar/gdbm/1.10/share/man --infodir=/usr/local/Cellar/gdbm/1.10/share/info --enable-shared
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
@adamvr
adamvr / README.md
Created August 22, 2012 20:25
Extracting music from an iDevice

Introduction

This script is specifically designed for reconstituting mp3s from the silly hash directories iDevices store their music in. It requires that the mp3s have working id3v2 tags, so use something like find . -name '*.mp3 -print0 | xargs -0Ixx id3v2 -C "xx" to convert them if they're in id3v1.

Usage

./extract.sh ~/music /media/IPOD/iPod_Control/Music

Caveats