Skip to content

Instantly share code, notes, and snippets.

@hmarr
hmarr / gitsh
Last active August 29, 2015 13:56
Apparently percent signs are the new cool
#!/bin/bash
echo -n "gitsh% "
while read line; do
if [[ "$line" == ":exit" ]]; then
exit
fi
sh -c "git $line"
echo -n "gitsh% "
@hmarr
hmarr / catsh
Created February 11, 2014 11:46
#!/bin/bash
echo -n "catsh% "
while read line; do
if [[ "$line" == ":exit" ]]; then
exit
fi
sh -c "cat $line"
echo -n "catsh% "

Keybase proof

I hereby claim:

  • I am hmarr on github.
  • I am hmarr (https://keybase.io/hmarr) on keybase.
  • I have a public key whose fingerprint is 5019 3A27 4A54 FCF3 525E EDC9 EC35 9447 F668 59CC

To claim this, I am signing this object:

@hmarr
hmarr / Gemfile
Last active August 29, 2015 14:02
Encoding issue in elasticsearch-ruby
source 'https://rubygems.org'
gem 'rspec'
gem 'elasticsearch', '~> 1.0.2'
@hmarr
hmarr / profile-after-patch.log
Created June 23, 2014 11:46
elasticsearch-ruby profile
Your Gemfile lists the gem elasticsearch-extensions (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Starting 2 Elasticsearch nodes.............
--------------------------------------------------------------------------------
Cluster: elasticsearch_test
Status: green
Nodes: 2
+ node-2 | version: 1.1.1, pid: 79902, address: inet[/0:0:0:0:0:0:0:0%0:9251]
- node-1 | version: 1.1.1, pid: 79901, address: inet[/0:0:0:0:0:0:0:0:9250]
@hmarr
hmarr / life.rs
Last active August 29, 2015 14:03
Conway's Game of Life in Rust
use std::io::{print};
use std::cmp::{min,max};
use std::time::Duration;
#[deriving(Clone,Show,PartialEq)]
enum Cell {
Alive,
Dead,
}
@hmarr
hmarr / gist:c1def5eebf3f084ad775
Last active August 29, 2015 14:05
Google Cloud IO...
$ touch ${HOME}/foobar; time sync
real 0m2.956s
user 0m0.000s
sys 0m0.012s
$ touch ${HOME}/foobar; time sync
real 0m0.286s
user 0m0.000s
sys 0m0.004s
$ echo "source 'https://rubygems.org'\ngem 'rails', '4.2.0'" > Gemfile && bundle install
[truncated]
Using rails 4.2.0
Your bundle is complete!
It was installed into ./.bundle
$ bundle exec ruby routing_issue.rb
Run options: --seed 9548
# Running:
import mongoengine
from mongoengine.document import Document
from mongoengine.fields import StringField, ListField
import time
from contextlib import contextmanager
from random import sample, randint
def create_data():
words = unicode(open('/usr/share/dict/words').read(), 'utf8').split()
// ==UserScript==
// @name GitHub Contributor Compare
// @description Adds a compare link to forked repo commit pages
// @match http://github.com/*/commit/*
// @match https://github.com/*/commit/*
// ==/UserScript==
var onLoad = function(callback) {
var script = document.createElement("script");
var src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js";