Skip to content

Instantly share code, notes, and snippets.

View jimeh's full-sized avatar

Jim Myhrberg jimeh

View GitHub Profile

Alternative Accounts

Below is a list of alternative GitHub accounts which I (@jimeh) use, and have full control over.

Verification

This document was GPG signed with:

@jimeh
jimeh / mustache.js
Created March 15, 2010 11:41
mustache.js — Super-simple Mustache-style text-replacement.
/*
Super-simple Mustache-style text-replacement.
Example:
var data = {name: "James", location: "Mars"};
mustache("Welcome to {{location}}, {{ name }}.", data); // => Welcome to Mars, James.
*/
function mustache(string, data){
@jimeh
jimeh / warrant of arrest.txt
Created July 26, 2012 21:16
Random and funny span email attachment
Anti-Terrorist and Monetary Crimes Division
FBI Headquarters In Washington, D.C.
Federal Bureau Of Investigation
J. Edgar Hoover Building
935 Pennsylvania Avenue, NW Washington, D.C. 20535-0001
@jimeh
jimeh / wait-for.sh
Last active May 25, 2023 09:15
wait-for.sh
#!/bin/sh
[ -n "$DEBUG" ] && set -x
check_http() {
wget -T 1 -S -q -O - "$1" 2>&1 | head -1 |
grep -E 'HTTP.+\s2[0-9]{2}' > /dev/null 2>&1
return $?
}
check_tcp() {
@jimeh
jimeh / domain-finder.go
Created November 15, 2022 17:27
domain-finder.go
package main
import (
"fmt"
"os"
"os/exec"
"strings"
"sync"
)
@jimeh
jimeh / .gitignore
Created December 24, 2009 11:51
A quick head-to-head performance test of JSON vs. BSON.
.DS_Store
data.rb
results.txt
@jimeh
jimeh / zsh-history-search-with-peco.zsh
Last active July 16, 2022 17:12
Use peco (https://github.com/peco/peco) to search ZSH's history via ctrl+R
# Search shell history with peco: https://github.com/peco/peco
# Adapted from: https://github.com/mooz/percol#zsh-history-search
if which peco &> /dev/null; then
function peco_select_history() {
local tac
(which gtac &> /dev/null && tac="gtac") || \
(which tac &> /dev/null && tac="tac") || \
tac="tail -r"
BUFFER=$(fc -l -n 1 | eval $tac | \
peco --layout=bottom-up --query "$LBUFFER")
@jimeh
jimeh / stub.bash
Last active February 16, 2022 23:00
Shell script helpers to stub and restore bash shell functions/commands in tests.
# Stub commands printing it's name and arguments to STDOUT or STDERR.
stub() {
local cmd="$1"
if [ "$2" == "STDERR" ]; then local redirect=" 1>&2"; fi
if [[ "$(type "$cmd" | head -1)" == *"is a function" ]]; then
local source="$(type "$cmd" | tail -n +2)"
source="${source/$cmd/original_${cmd}}"
eval "$source"
fi
@jimeh
jimeh / jquery.myplugin.coffee
Created April 7, 2011 23:44
Example jQuery plugin written in CoffeeScript, and the resulting compiled JavaScript file.
$.fn.extend
myplugin: (options) ->
self = $.fn.myplugin
opts = $.extend {}, self.default_options, options
$(this).each (i, el) ->
self.init el, opts
self.log el if opts.log
$.extend $.fn.myplugin,
default_options: