Skip to content

Instantly share code, notes, and snippets.

Avatar

Brett Wilkins bwilkins

  • Elevate Partners; Digit.co
  • Melbourne, Australia
View GitHub Profile
View php.rb
class String;alias phpversion to_s;end
alias echo print
def function(a);n,b=*a;define_singleton_method(n,&b);end
def method_missing(n,&b);(n=~/^to_/).nil?? [n,b]:nil;end
function displayVersion() {
echo "this is PHP " . phpversion();
echo "\n";
}
View keybase.md

Keybase proof

I hereby claim:

  • I am bwilkins on github.
  • I am bugg (https://keybase.io/bugg) on keybase.
  • I have a public key ASBWzrfxxyTLekoz-04U_fEf-BnissXWu4p-ROafsm2tCgo

To claim this, I am signing this object:

View hoist_wtf.rb
$ ruby hoist_wtf.rb
hoist_wtf.rb:8:in `do_thing': undefined method `+' for nil:NilClass (NoMethodError)
from hoist_wtf.rb:13:in `<main>'
$
View add_custom_cert_to_boot2docker
docker-machine ssh dockerosx
# On the docker machine
sudo su
cat > /var/lib/boot2docker/hooroo.pem <<CERTFILE
-----BEGIN CERTIFICATE-----
MIIDCDCCAnGgAwIBAgIJAL/rbFkj0BMCMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYD
VQQGEwJBVTERMA8GA1UECAwIVmljdG9yaWExEjAQBgNVBAcMCU1lbGJvdXJuZTEX
MBUGA1UECgwOSG9vcm9vIFB0eSBMdGQxITAfBgNVBAsMGEhvb3JvbyBTZWN1cml0
eSAoSG9vU2VjKTEqMCgGA1UEAwwhSG9vcm9vIFByaW1hcnkgUm9vdCBDQSAtIElu
View gist:6880416
{
"message": ...massive XML blob...
"@timestamp" => "2013-10-08T06:32:22.374Z",
"@version" => "1",
"host" => "Rogue.local",
"path" => "/Users/lupin/Projects/hotels/log/pegasus_search_development.log"
}
@bwilkins
bwilkins / gist:6880262
Created Oct 8, 2013
Attempts with logstash
View gist:6880262
I've got multiple attempts of the same thing. I'm trying to pull out many values that have the same attribute name/destination field name (not the first inside-head alarm bell).
input {
file {
debug => true
start_position => "beginning"
# type => "pegasus"
# add_field => ["xmlraw", "%{@message}"]
path => [ "/Users/lupin/Projects/hotels/log/pegasus_search_development.log" ]
}
@bwilkins
bwilkins / Go_OpenGL.trace
Created Sep 30, 2013
Apitrace of simple OpenGL app in Go (doesn't work) vs virtually the same app in C/Objective-C (works). Only thing I can see that's really overly different is the pointer length in the go application, which appear to be 2 bytes(?) shorter...
View Go_OpenGL.trace
0 CGLSetOption(pname = kCGLGOUseErrorHandler, param = 0) = kCGLNoError
1 CGLChoosePixelFormat(attribs = {kCGLPFADoubleBuffer, kCGLPFAOpenGLProfile, 12800, kCGLPFAColorSize, 24, kCGLPFAAlphaSize, 8, 0}, pix = &0x17a1a400, npix = &2) = kCGLNoError
2 CGLSetOption(pname = kCGLGOUseErrorHandler, param = 0) = kCGLNoError
3 CGLCreateContext(pix = 0x17a1a400, share = NULL, ctx = &0x1900ec00) = kCGLNoError
4 CGLSetParameter(ctx = 0x1900ec00, pname = 1236, params = &396468976) = kCGLNoError
5 CGLSetSurface(ctx = 0x1900ec00, cid = 0x1ad77, wid = 11190, sid = 1211499212) = kCGLNoError
6 CGLSetCurrentContext(ctx = 0x1900ec00) = kCGLNoError
7 glViewport(x = 0, y = 0, width = 800, height = 600)
8 glScissor(x = 0, y = 0, width = 800, height = 600)
9 CGLDescribePixelFormat(pix = 0x17a1a400, pix_num = 0, attrib = kCGLPFAAccelerated, value = &1) = kCGLNoError
@bwilkins
bwilkins / gist:1715027
Created Feb 1, 2012
Hopefully faster/better version of previous tax function
View gist:1715027
function tax(total) {
var accum = 0;
var tiers = [
0,
14000,
48000,
70000,
]
@bwilkins
bwilkins / gist:1714960
Created Feb 1, 2012
My quick hack-up to calculate NZ PAYE tax on individual yearly gross income. Added whitespace for readability (originally wrote in jconsole, just to discover it can't do multi-line function defs)
View gist:1714960
function tax(total) {
var accum = 0
for (var dollar=0; dollar < total; dollar++) {
if (dollar < 14000)
accum+=0.1254
else if (dollar < 48000)
accum+=0.1954
View team role management
Context: Multiple people in a team. Each person has similar skillset. Want to encourage roles/responsibilities within team over a certain time period (shift, day, week, etc)
Proposition: Application that tracks team and their roles for the day. Team members are encourages to pick a role they are less familiar with.