Skip to content

Instantly share code, notes, and snippets.

Larry Kyrala coldnebo

  • Boston, MA
Block or report user

Report or block coldnebo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@coldnebo
coldnebo / lkdebug.rb
Created Dec 20, 2018
rails debug helper for tracking mutating state across contexts
View lkdebug.rb
# debugging helper for tracing variable changes across contexts in legacy code. The context information such as file, line,
# class and method are automatically logged for you so you can focus on tracing the state mutations through various contexts
# with ease.
# @note this top-level method may be placed in config/initializers/lkdebug.rb and used anywhere
# @note this method does nothing outside of Rails.env.development
# @note legacy examples are intentionally bad code!! You should not write code like this, but if you have to debug code like this
# you may want to dump state from various contexts within the program to understand what is going on.
#
# @param annotation [String] text comment providing context for the log.
@coldnebo
coldnebo / boolean_function.rb
Created Oct 12, 2018
playing around with recomposing predicates.
View boolean_function.rb
require 'csv'
class BooleanFunction
attr_reader :inputs, :input_values, :output, :output_values
BOOLEAN_SET = [true, false]
def initialize( inputs:, output: nil )
raise ArgumentError, "inputs must be an Enumerable of symbols" if (!inputs.kind_of?(Enumerable) || !inputs.map{|e| e.is_a?(Symbol) }.reduce(:&))
@output = output
@coldnebo
coldnebo / database.yml
Created Oct 11, 2018
description of our Rails multi-database configuration for @eileencodes
View database.yml
---
# defaults for all envs (local/deployed), (nonprod/prod)
defaults: &defaults
encoding: utf8
adapter: mysql2
read_timeout: 10
write_timeout: 10
connect_timeout: 10
reconnect: true
@coldnebo
coldnebo / im_manip_scripts.sh
Last active May 20, 2018
ruby orchestra preprint utils
View im_manip_scripts.sh
declare -a arr=("violin1" "violin2" "viola" "cello" "bass")
for inst in "${arr[@]}"
do
#inst="violin2"
title="Souza - The Stars and Stripes Forever"
# create a blank letter page for titles
View rubyvm.patch
diff --git a/random.c b/random.c
index e669e98..9334921 100644
--- a/random.c
+++ b/random.c
@@ -521,7 +521,7 @@ fill_random_bytes_syscall(void *seed, size_t size, int unused)
CryptGenRandom(prov, size, seed);
return 0;
}
-#elif defined __linux__ && defined SYS_getrandom
+#elif defined __linux__ && defined __NR_getrandom
View linux-Preferences.sublime-settings
{
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"font_size": 11,
"ignored_packages":
[
"Vintage"
],
"tab_size": 2,
"translate_tabs_to_spaces": true,
"hot_exit": false,
@coldnebo
coldnebo / logic_init.sqf
Last active May 19, 2019
clearcut script to clear foliage from markers in Arma3 on Tanoa.
View logic_init.sqf
/*
clearcut script to clear foliage from markers in Arma3 on Tanoa.
1. place this script in a Game Logic init
2. place one area marker (ELLIPSE/circle) named "cutter" and size it a=b in the EDEN editor
3. copy that marker to create as many clean-cut areas as you want
on startup, this script will automatically find any trees, small rocks fallen logs
within those markers and hide them.
@coldnebo
coldnebo / bashrc_functions.sh
Last active Feb 6, 2016
how I manage my paths
View bashrc_functions.sh
pathadd() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="${PATH:+"$PATH:"}$1"
fi
}
pathoverride() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="$1${PATH:+":$PATH"}"
fi
@coldnebo
coldnebo / genhtml.rb
Last active Aug 29, 2015
poor man's webcomponents, circa May 2010
View genhtml.rb
# genhtml.rb
require 'rubygems'
require 'xml/libxml'
require 'libxslt'
xml_file = ARGV[0]
stylesheet_doc = XML::Document.file('homework.xsi')
stylesheet = LibXSLT::XSLT::Stylesheet.new(stylesheet_doc)
@coldnebo
coldnebo / turbulence.m
Last active Aug 29, 2015
script for extracting the turbulence around a photo of a building.
View turbulence.m
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];
You can’t perform that action at this time.