Skip to content

Instantly share code, notes, and snippets.

View rjnienaber's full-sized avatar

Richard Nienaber rjnienaber

View GitHub Profile
@rjnienaber
rjnienaber / orgchartBuilder.py
Created February 18, 2011 06:03
Script to build an organizational chart from Active Directory
'''
Copyright (c) 2011, Richard Nienaber
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
The name of 'Richard Nienaber' may not be used to endorse or promote products derived from this software without specific prior written permission.
require 'stopwatch'
class Dummy
extend MethodDecorators
+Stopwatch
def test
sleep(0.1)
end
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\]$ "
require 'sinatra'
before do
puts "PARAMS: #{params.inspect}" #PARAMS: {}
end
get '/hi/:greeting' do
puts "PARAMS: #{params.inspect}" #PARAMS: {"splat"=>[], "captures"=>["Hello"], "greeting"=>"Hello"}
"#{params[:greeting]} World!"
end
@rjnienaber
rjnienaber / aspector_aop.rb
Last active December 21, 2015 06:08
An example of AOP in Ruby using aspector (includes benchmark)
require 'aspector'
require 'benchmark'
ITERATIONS = 100_000
class MyProcessor
def test_one
1 + 1
end
end
@rjnienaber
rjnienaber / aquarium_aop.rb
Last active December 21, 2015 06:09
An example of AOP in Ruby using Aquarium
require 'rubygems'
require 'benchmark'
require 'aquarium'
ITERATIONS = 100_000
class MyProcessor
def test_one
1 + 1
end
@rjnienaber
rjnienaber / gist:6351620
Created August 27, 2013 09:47
Comparing PyPy 2.1 (2.7.3) against PyPy3-beta 1 (3.2.3) using CPython benchmarks
$ pypy-2.1/bin/pypy --version
Python 2.7.3 (480845e6b1dd, Jul 31 2013, 09:57:07)
[PyPy 2.1.0 with GCC 4.6.3]
$ pypy3-2.1-beta1-linux64/bin/pypy --version
Python 3.2.3 (d63636b30cc0, Jul 30 2013, 07:02:17)
[PyPy 2.1.0-beta1 with GCC 4.6.3]
~/projects/pypy-2.1/bin/pypy perf.py --fast -b 2n3,threading,-fastunpickle,-fastpickle ~/projects/pypy-2.1/bin/pypy ~/projects/pypy3-2.1-beta1-linux64/bin/pypy > ~/projects/results.txt
@rjnienaber
rjnienaber / platcheck_29.c
Created August 29, 2013 20:43
PyPy error
/* Define on Darwin to activate all library features */
#define _DARWIN_C_SOURCE 1
/* This must be set to 64 on some systems to enable large file support. */
#define _FILE_OFFSET_BITS 64
/* Define on Linux to activate all library features */
#define _GNU_SOURCE 1
/* This must be defined on some systems to enable large file support. */
#define _LARGEFILE_SOURCE 1
/* Define on NetBSD to activate all library features */
(vagrant-setup)$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 8080 => 28080 (adapter 1)
@rjnienaber
rjnienaber / gist:39c371ca4265ea121728
Created August 22, 2014 21:07
ubuntu 12.04 vagrant up
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
default: URL: https://vagrantcloud.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v14.04) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/ubuntu/trusty64/version/1/provider/virtualbox.box
==> default: Successfully added box 'ubuntu/trusty64' (v14.04) for 'virtualbox'!