Skip to content

Instantly share code, notes, and snippets.

View brianjriddle's full-sized avatar

Brian Riddle brianjriddle

View GitHub Profile
@brianjriddle
brianjriddle / burn-example.sh
Created October 29, 2012 15:24
burn an linux|*bsd distro to usb
sudo dd if=$HOME/Downloads/ubuntu-12.10-desktop-i386.iso of=/dev/rdisk1 bs=20m
@brianjriddle
brianjriddle / jumbler.rb
Created November 3, 2012 13:12
takes a directory of files and randomizes the names by prefixing them with a number
# encoding: utf-8
require "fileutils"
include FileUtils::Verbose
def usage
puts "usage: jruby ORIGINAL_MUSIC_DIR"
end
if ARGV[0] and File.directory? ARGV[0]
public class Locale {
public static void main(String[] args) {
System.out.println(System.getProperty("file.encoding"));
System.out.println(System.getenv("LC_CTYPE"));
}
}
@brianjriddle
brianjriddle / ocunitfilter.rb
Last active December 13, 2015 19:58
filter to get sane output from ocunit & kiwi tests when building xcode apps from the command line
#!/usr/bin/env ruby
$stdout.sync = true
@failed_tests = []
@success = true
@executed = ""
def green(s)
"\e[1;32m#{s}\e[0m"
end
@brianjriddle
brianjriddle / Rakefile
Created February 16, 2013 12:53
Rakefile used to deploy a jekyll site to s3
require 'rake/clean'
require 'jekyll'
require 'jekyll/site'
#remove the site dir.
CLEAN.include('_site')
desc "generate the site. keeping it simple."
task :generate do
options = Jekyll.configuration({})
@brianjriddle
brianjriddle / create_objc_from_json.rb
Created April 25, 2013 06:50
a little boilerplate for creating objective-c classes from json data
require 'json'
require 'open-uri'
def camel_case(string)
return string.split('_').map{|e| e.capitalize}.join
end
def camel_case_lower(s) s.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
end
json = JSON.load(open(ARGV[0]))
@brianjriddle
brianjriddle / aapt-badger.txt
Last active April 19, 2019 15:47
who put that badger in androids aapt. scroll all the way to the end.
➜ ~ cd $ANDROID_SDK ➜ r21.1 git:(master) pwd /usr/local/Cellar/android-sdk/r21.1
➜ r21.1 git:(master) cd platform-tools ➜ platform-tools git:(master) strings aapt nonav
dpad
navexposed
nokeys
12key
keysexposed
keyshidden
notouch
stylus
@brianjriddle
brianjriddle / ant-build-snippet.xml
Created July 25, 2013 11:01
ant task to run all the tests or only one test. You'll need to supply the properties where to find your test source, libs and what not. Mainly here so i don't have to look this up again because it's not often need to do this but ant's as poorly written as this sentence.
<target name="run-tests" depends="compile">
<junit failureproperty="test.failure" includeantruntime="false">
<classpath refid="run.classpath"/>
<formatter type="plain" usefile="no"/>
<batchtest todir="${reports.dir}" unless="test">
<fileset dir="${source.dir}" includes="**/*Test.java"/>
<formatter type="xml"/>
</batchtest>
@brianjriddle
brianjriddle / build.xml
Created September 22, 2013 08:00
Ant tasks to check if working directory is clean.
<?xml version="1.0" encoding="UTF-8"?>
<project name="git" default="is-working-directory-clean">
<target name="-git-status">
<exec executable="git" outputproperty="git.status.message" failifexecutionfails="false" errorproperty="">
<arg value="status"/>
<arg value="--short"/>
</exec>
<condition property="git.clean.wd">
<and>
@brianjriddle
brianjriddle / jenkins-farwell.txt
Created November 6, 2013 07:40
farewell jenkins
Hej Jenkins,
Vi behöver prata.
Vi har varit ihop några år nu men som Oall good things¹ även vi måste ta
slut.
Du har fått ögonen upp för andra och jag känner att det är dags för mig
att släppt dig fri.