Skip to content

Instantly share code, notes, and snippets.

View coldnebo's full-sized avatar

Larry Kyrala coldnebo

View GitHub Profile
@coldnebo
coldnebo / turbulence.m
Last active August 29, 2015 14:24
script for extracting the turbulence around a photo of a building.
close all
% read the building picture
I1 = imread('IMG_5380.JPG');
% correct the rotation
I2 = imrotate(I1, -90);
% crop it to the area of interest
I3 = imcrop(I2,[378.5 0.5 948 814]);
% focus on an roi to isolate just the sky from the building...
rp = [0 815;70 815;251 435;570 363;949 657;949 0;0 0];
@coldnebo
coldnebo / require_speedtest.rb
Last active August 29, 2015 14:10
measure how fast gem require is.
require 'benchmark'
include Benchmark
def with_require
fork { require 'rake' }
end
def without_require
fork {}
end
@coldnebo
coldnebo / another_partial.html.erb
Last active August 29, 2015 14:09
capture doesn't work outside of the view it's in?
alert('something');
@coldnebo
coldnebo / arma2.bat
Last active December 22, 2015 13:49
ARMA stuff
set "STEAMHOME=F:\games\steam\steamapps\common"
rem =========================== mods =========================
rem Latest mod versions as of 10/16/2013:
rem CBA*: Community Base Addons CBA_v1.0.0pre10.7z: http://dev-heaven.net/attachments/download/19512/CBA_v1.0.0pre10.7z
rem ASR_AI: Improved AI @ASR_AI_v1_16_1.7z: http://www.armaholic.com/page.php?id=12105&a=dl
rem ACEX_SM: Improved Sound Effects @ACEX_SM_v1.13.0.100.7z: http://www.armaholic.com/page.php?id=12160&a=dl
rem Blastcore: Better Explosions @Blastcore_Visuals_R1.2.rar: http://www.armaholic.com/page.php?id=12975&a=dl
rem sthud: Situational Awareness 121209_sthud_islandfree.7z: http://www.armaholic.com/page.php?id=9936&a=dl
@coldnebo
coldnebo / Gemfile
Last active December 21, 2015 00:08
files for reproduction of Bundler issue #2593 -- https://github.com/bundler/bundler/issues/2593
source 'https://rubygems.org'
gemspec
@coldnebo
coldnebo / rails_trace.rb
Last active December 1, 2018 08:10
This Rack middleware for Rails3 lets you see a call-trace of the lines of ruby code in your application invoked during a single request. Only code within your app is considered (i.e. in the /app folder). This expands on my previous attempt (https://gist.github.com/3077744). Example of output in comments below.
require 'singleton'
# outputs a colored call-trace graph to the Rails logger of the lines of ruby code
# invoked during a single request.
#
# Example:
#
# 1) Make sure this file is loaded in an initializer
#
# 2) Add the following to your application.rb in Rails3:
@coldnebo
coldnebo / local_tracer_patch.rb
Created July 9, 2012 17:23
unroller replacement for rails...
# to be used only for local debugging
LK_ENABLE_TRACE = false
if LK_ENABLE_TRACE && Rails.env.development?
require 'thread'
class LkTracer
def initialize
@coldnebo
coldnebo / bday.rb
Created June 25, 2012 14:39
a set of diophantine equations relating father and son...
# Interesting relationships:
# Say the father's age is 72 and the son's age is 40.
# The father was born in 1940 and the son in 1972.
# Isn't that curious?
# In english, the dad's age is the current year minus the dad's birth year,
# the right-most 2 digits of the dad's birth year is the son's age,
@coldnebo
coldnebo / example.rb
Created May 7, 2012 11:49
trying to SimpleDelegator an AREL object
# based on http://tatey.com/2012/02/07/mocking-with-minitest-mock-and-simple-delegator/
class Order < ActiveRecord::Base
# …
end
class MyController < ApplicationController
def index
@orders = Order.find(:all)
end
@coldnebo
coldnebo / Gemfile
Created March 27, 2012 18:20
how to get ruby 1.9.3-p125 and ruby-debug working on ubuntu 11.10
source 'http://rubygems.org'
# your gems here.
group :development do
# from http://beginrescueend.com/support/troubleshooting/
# requires running:
# $ rvm reinstall 1.9.3 --patch debug --force-autoconf
#
# my platform section below may be debatable (lots of ways to skin the cat) but the crucial part