Skip to content

Instantly share code, notes, and snippets.

View bwilkins's full-sized avatar

Brett Wilkins bwilkins

  • SmartSheet
  • Brisbane, Australia
  • 06:03 (UTC +10:00)
View GitHub Profile
@bwilkins
bwilkins / php.rb
Last active November 13, 2018 21:56
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";
}

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:

{
"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 October 8, 2013 06:13
Attempts with logstash
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 September 30, 2013 11:11
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...
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
$ ruby hoist_wtf.rb
hoist_wtf.rb:8:in `do_thing': undefined method `+' for nil:NilClass (NoMethodError)
from hoist_wtf.rb:13:in `<main>'
$
docker-machine ssh dockerosx
# On the docker machine
sudo su
cat > /var/lib/boot2docker/hooroo.pem <<CERTFILE
-----BEGIN CERTIFICATE-----
MIIDCDCCAnGgAwIBAgIJAL/rbFkj0BMCMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYD
VQQGEwJBVTERMA8GA1UECAwIVmljdG9yaWExEjAQBgNVBAcMCU1lbGJvdXJuZTEX
MBUGA1UECgwOSG9vcm9vIFB0eSBMdGQxITAfBgNVBAsMGEhvb3JvbyBTZWN1cml0
eSAoSG9vU2VjKTEqMCgGA1UEAwwhSG9vcm9vIFByaW1hcnkgUm9vdCBDQSAtIElu
@bwilkins
bwilkins / gist:1715027
Created February 1, 2012 04:06
Hopefully faster/better version of previous tax function
function tax(total) {
var accum = 0;
var tiers = [
0,
14000,
48000,
70000,
]
@bwilkins
bwilkins / gist:1714960
Created February 1, 2012 03:46
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)
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
@bwilkins
bwilkins / team role management
Created June 11, 2009 19:41
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.