Skip to content

Instantly share code, notes, and snippets.

View elcritch's full-sized avatar

Jaremy Creechley elcritch

View GitHub Profile
@elcritch
elcritch / simplify_mat.jl
Created June 30, 2015 16:34
Simplify simple Matlab-based data file in Julia, turn dicts keys into symbols. Hopefully this is just a "temp hack".
simplify_mat(d::Dict{ASCIIString, Any}) = Dict{Symbol, Any}( [ symbol(string(k)) => simplify_mat(v) for (k,v) in d ] )
simplify_mat(arr::Array{Float64,2}) = arr[:] # slicing???
simplify_mat(o::Any) = o
@elcritch
elcritch / example-numerical-diff.jl
Created June 30, 2015 18:25
Example of numerical differentiation in Julia – Quick mental verification
xr = 0:0.5:2π
plot( xr, sin(xr) )
plot( xr[1:end-1], diff(sin(xr)) ./ diff(xr) )
@elcritch
elcritch / julia_json_data_macro
Created July 10, 2015 01:34
Example macro to allow embedding JSON style data structures into Julia dev-v0.4
# Tested on VERSION => v"0.4.0-dev+5879"
macro data(data) _json(data) end
macro json(data) _json(data) end
function _json(data::Any)
data
end
function _json(data::Expr)
if data.head === :cell1d
@elcritch
elcritch / gist:3a4e0f9f85dd9d3e5974
Created July 17, 2015 14:20
Add an application to mac's gateway
spctl --add /Path/To/Application.app
@elcritch
elcritch / gist:8ecbe83943eafb5b7009
Created October 21, 2015 20:11
Git Merge Conflict: accept ours/theirs
git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
Verifying that +elcritch is my blockchain ID. https://onename.com/elcritch
@elcritch
elcritch / AutoHotKey.ahk
Created April 1, 2016 02:06
Windows AutoHotKey mapping to provide "emacs/os x" style movement keys and browser tab movement. (Use at your own risk!)
LWin::LCtrl
RWin::RCtrl
^!r::
MsgBox, AutoHotKey reloaded!
Reload
return
^+]::
@elcritch
elcritch / json-hack2.js
Last active April 20, 2016 00:58
Hacked Json Viewer
function codify() {
$('span.out:contains("{"):not(.json-parsed)').each(function() {
var text = $(this).ignore().text();
var nodes = $(this).find("*").clone();
var res = text.replace(/(\{.+\})/, function (x) {
var s = '</span><code class="lang-json">';
s += "" + x + "";
s += '</code><br><span class="non-code">';
return s ;
});
@elcritch
elcritch / json-hack.js
Last active July 25, 2016 01:57
JSON viewer hack
function codify() {
$('span:contains("{")').each(function() {
var text = $(this).ignore().text();
var nodes = $(this).find("*").clone();
var res = text.replace(/(\{.+\})/, function (x) {
var s = '</span><code class="lang-json">';
s += "" + x + "";
s += '</code><br><span class="non-code">';
return '<span class="non-code">' + s + '</span>';

Creating a Youtube Widget