Skip to content

Instantly share code, notes, and snippets.

Avatar
🚲
Thinking about riding

Alan Harper aussiegeek

🚲
Thinking about riding
View GitHub Profile
View Brewfile
# frozen_string_literal: true
# exa & bat are used in my .zshrc aliases, so install it asap
brew 'exa'
brew 'bat'
tap 'homebrew/bundle'
tap 'homebrew/cask'
tap 'homebrew/services'
tap 'homebrew/cask-drivers'
View keybase.md
{
    "body": {
        "key": {
            "fingerprint": "02d7aaa16da8c4f33c0880121da5b9b0890e9e75",
            "host": "keybase.io",
            "key_id": "1DA5B9B0890E9E75",
            "uid": "9cfb3b33c884fd59287d29a437826100",
            "username": "aussiegeek"
        },
@aussiegeek
aussiegeek / tramtracker.rb
Created Jul 25, 2013
Job to get tram data for dashing
View tramtracker.rb
require "rexml/document"
SCHEDULER.every '1m', :first_in => 0 do |job|
stop_no = 1819
url = URI.parse('http://ws.tramtracker.com.au/pidsservice/pids.asmx')
request =Net::HTTP::Post.new(url.path)
request.body = %Q{<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Header>
<PidsClientHeader xmlns="http://www.yarratrams.com.au/pidsservice/">
View gist:726422
$ gh fork
/Users/alan/.rvm/gems/ruby-1.9.2-p0/gems/github-0.4.5/lib/github/extensions.rb:11: warning: undefining `object_id' may cause serious problems
/Users/alan/.rvm/gems/ruby-1.9.2-p0/gems/github-0.4.5/lib/github.rb:151:in `module_eval': /Users/alan/.rvm/gems/ruby-1.9.2-p0/gems/github-0.4.5/lib/commands/commands.rb:57: syntax error, unexpected ')' (SyntaxError)
helper.tracking.sort { |(a,),(b,)| a == helper.origin ? -...
^
/Users/alan/.rvm/gems/ruby-1.9.2-p0/gems/github-0.4.5/lib/commands/commands.rb:57: syntax error, unexpected '|', expecting '='
...per.tracking.sort { |(a,),(b,)| a == helper.origin ? -1 : b ...
... ^
/Users/alan/.rvm/gems/ruby-1.9.2-p0/gems/github-0.4.5/lib/commands/commands.rb:57: syntax error, unexpected '}', expecting keyword_end
...rigin ? 1 : a.to_s <=> b.to_s }.each do |(name,user_or_url)|
View s3_backup.sh
#!/bin/sh
export AWS_ACCESS_KEY_ID="<s3 access id>"
export AWS_SECRET_ACCESS_KEY="<s3 secret access key>"
export PASSPHRASE="" #left blank intentionally
export DEST="s3+http://<backup bucket name>/"
export SRC="<local src path>"
export GPG_KEY="<e-mail address of gpg key>"
duplicity --encrypt-key $GPG_KEY --full-if-older-than 1M $SRC $DEST
duplicity remove-older-than 1Y $DEST --force
duplicity cleanup $DEST --force
View people.m
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFMutableArrayRef peopleMutable = CFArrayCreateMutableCopy(
kCFAllocatorDefault,
CFArrayGetCount(people),
people
);
CFRelease(people);
View gist:327559
RewriteCond %{REQUEST_URI} !^/(store|images|scripts|favicon.ico|javascript|SpryAssets|stylesheets|robots.txt).*
RewriteRule (.*) http://www.domain.com$1 [R,L]
View gist:195086
<?php
function verify_password($password, $crypted_password, $password_salt) {
$digest = $password . $password_salt;
for ($i=0; $i < 20; $i++) {
$digest = hash('sha512', $digest);
}
return $digest == $crypted_password;
}
?>
View gemdocs.sh
export GEMDIR=`gem env gemdir`
gemdoc() {
open $GEMDIR/doc/`$(which ls) $GEMDIR/doc | grep $1 | sort | tail -1`/rdoc/index.html
}
_gemdocomplete() {
COMPREPLY=($(compgen -W '$(`which ls` $GEMDIR/doc)' -- ${COMP_WORDS[COMP_CWORD]}))
return 0
}
View haml_options.rb
Haml::Template.options = {:attr_wrapper => "\""}