Skip to content

Instantly share code, notes, and snippets.

View JesseBuesking's full-sized avatar

Jesse Buesking JesseBuesking

View GitHub Profile
@JesseBuesking
JesseBuesking / ruby_trace.rb
Created January 31, 2017 21:32
A method to trace variable changes in your project. Set `__trace_if__` to return true to print *every* line, or have it print conditionally. In the example below I print only when the variable `boof` changes.
lambda do
trace_default_frame = lambda do
{ locals: {} }
end
trace_stack = [trace_default_frame[]]
set_trace_func proc { |event, file, line, id, binding, classname|
if event == 'call' || event == 'c-call'
trace_stack << trace_default_frame[]
@JesseBuesking
JesseBuesking / numerizer_patch.rb
Created January 10, 2017 14:56
Attempting to patch the numerizer gem
require 'numerizer'
require 'chronic'
puts Numerizer.method(:numerize).source_location
#module NumerizerExpand
#module ClassMethods
#def self.numerize(value)
#raise
#end

Keybase proof

I hereby claim:

  • I am jessebuesking on github.
  • I am jessebuesking (https://keybase.io/jessebuesking) on keybase.
  • I have a public key ASAwURLz0E9PwqkAzHSOa2iTN9eymptuiUoVxqbOtnyeDgo

To claim this, I am signing this object:

@JesseBuesking
JesseBuesking / install_opencv.sh
Created July 9, 2015 03:02
installs opencv 2.4.11
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen3-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev default-jdk ant libvtk5-qt4-dev
wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.11/opencv-2.4.11.zip
unzip opencv-2.4.11.zip
cd opencv-2.4.11
mkdir build
[global]
device = gpu
floatX = float32
[nvcc]
compiler_bindir=C:\programs86\Microsoft Visual Studio 12.0\VC\bin
flags=-m32 # we have this hard coded for now
[blas]
ldflags =
@JesseBuesking
JesseBuesking / logging.yaml
Created April 14, 2014 18:54
Testing MultiProcessingLog on both Windows 7 Enterprise and Ubuntu Developers Version 10.04_20121120.
---
version: 1
disable_existing_loggers: False
formatters:
simple:
format: "%(name)-20s%(levelname)-8s%(message)s"
handlers:
console:
class: logging.StreamHandler
level: DEBUG
@JesseBuesking
JesseBuesking / pprint_defaulttict.py
Created March 17, 2014 17:51
Pretty prints a default dict in IPython
def pprint_defaultdict():
from collections import defaultdict
import IPython
ip = get_ipython()
tf = ip.display_formatter.formatters['text/plain']
def _print_default_dict(arg, p, cycle):
""" Pretty print a defaultdict. """
def rec(obj, indent=0, level=0):
if isinstance(obj, defaultdict) or isinstance(obj, dict):
p.text('{\n')
@JesseBuesking
JesseBuesking / create-package.bat
Last active January 3, 2016 04:09
Creating a virtualenv and updating so that the compiler is set to mingw32 (so that things like cython can be installed via pip).
virtualenv --distribute --no-site-packages %1
python update-mingw-compiler.py %1
public struct Id
{
private long _id;
public Id(long id)
{
this._id = id;
}
public static implicit operator Id(long value)
public class Singleton
{
private static readonly Lazy<Singleton> _lazy = new Lazy<Singleton>(
() => new Singleton(), LazyThreadSafetyMode.ExecutionAndPublication);
public static Singleton Instance
{
get
{
return Singleton._lazy.Value;