Skip to content

Instantly share code, notes, and snippets.

View jtmkrueger's full-sized avatar
🎉
Working from home

John Krueger jtmkrueger

🎉
Working from home
View GitHub Profile
--type-add=js=.ejs
--type-add=ruby=.erb
--type-add=css=.sass
--type-add=ruby=.feature
@elskwid
elskwid / verify_fingerprint.rb
Created March 7, 2012 18:42
Display the fingerprints for all your public keys
#! /usr/bin/ruby
home_dir = ENV["HOME"]
ssh_dir = "#{home_dir.strip}/.ssh/*.pub"
puts "Checking #{ssh_dir} ..."
puts
Dir["#{home_dir.strip}/.ssh/*.pub"].each do |pk|
puts "Fingerprint for #{pk}"
fingerprint = `ssh-keygen -lf #{pk}`
@leh
leh / restart_tmux
Created October 18, 2012 15:58
start or restore a tmux session named after your current working directory
# Switching projects like mad?
# t: start or restore a tmux session named after your current working directory
#
# e.g. calling t in /home/project/awesome_project will reattach the tmux session named
# awesome_project or create a new one
t() { tmux attach-session -t $(pwd | awk -F/ '{print $NF}') || tmux new-session -s $(pwd | awk -F/ '{print $NF}') ; }
@Kapeli
Kapeli / gist:5017177
Created February 22, 2013 22:43 — forked from yjsoon/gist:3474117
" Search Dash for word under cursor
function! SearchDash()
let s:browser = "/usr/bin/open"
let s:wordUnderCursor = expand("<cword>")
let s:url = "dash://".s:wordUnderCursor
let s:cmd ="silent ! " . s:browser . " " . s:url
execute s:cmd
redraw!
endfunction
map <leader>d :call SearchDash()<CR>

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@shtirlic
shtirlic / mono.rb
Last active May 21, 2017 16:55
Latest mono formula for homebrew
# http://www.mono-project.com/Compiling_Mono_on_OSX
require 'formula'
class Mono < Formula
#url 'http://download.mono-project.com/sources/mono/mono-3.0.6.tar.bz2'
#sha1 'e2187f80366fcd65c55a1ab946f8d3b39e81be77'
url 'http://download.mono-project.com/sources/mono/mono-2.10.9.tar.bz2'
sha1 '1a6e8c5a0c3d88d87982259aa04402e028a283de'

Fibur

Fibur is a library that allows concurrency during Ruby I/O operations without needing to make use of callback systems. Traditionally in Ruby, to achieve concurrency during blocking I/O operations, programmers would make use of Fibers and callbacks. Fibur eliminates the need for wrapping your I/O calls with Fibers and a callback. It allows you to write your blocking I/O calls the way you normally would, and still have concurrent execution during those I/O calls.

Example

Say you have a method that fetches data from a network resource:

@zenkay
zenkay / gist:3237860
Created August 2, 2012 15:19
Installation tips for RVM/Ruby on OSX 10.8 Mountain Lion

Ruby, RVM and Mountain Lion

Key problems

Mountain Lion (10.8) has three main difference compared to Lion (10.7):

  • XCode 4.4 does not install Command Line Tools by default
  • X11 isn't available anymore
  • The installed version of OpenSSL has some bugs

How to work around

@rmeissn
rmeissn / outliersFilter.js
Last active July 20, 2021 12:13
A Javascript function to filter an array of values for outliers by using an interquartile filter
function filterOutliers(someArray) {
if(someArray.length < 4)
return someArray;
let values, q1, q3, iqr, maxValue, minValue;
values = someArray.slice().sort( (a, b) => a - b);//copy array fast and sort
if((values.length / 4) % 1 === 0){//find quartiles