Skip to content

Instantly share code, notes, and snippets.

Michael Mahemoff mahemoff

Block or report user

Report or block mahemoff

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
@mahemoff
mahemoff / unicorn
Last active Aug 29, 2015 — forked from ethier/gist:7190310
Update the upgrade function - it captures the old PID before it's overwritten by the upgrade (ie USR2 signal), then kills it once the upgrade has succeeded
View unicorn
#!/bin/sh
# forked from https://gist.github.com/ethier/7190310
# via http://uncorruptedstate.com/blog/2013/10/27/zero-downtime-deployment-with-rails-and-unicorn/
### Unicorn variables ###
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/home/web/current
UNICORN=$APP_ROOT/bin/unicorn
TMP_PATH=$APP_ROOT/tmp
PID_PATH=$APP_ROOT/tmp/pids
@mahemoff
mahemoff / ask-wikipedia.rb
Last active Aug 29, 2015 — forked from emad-elsaid/ask-wikipedia.rb
Refactor processing, make script standalone with initial env, add command-line argument
View ask-wikipedia.rb
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
language = 'en'
article = ARGV[0] ||
begin
print 'What do you need to know? : '
URI::encode gets.chomp
@mahemoff
mahemoff / private.xml
Last active Dec 15, 2015 — forked from burtlo/private.xml
(1) Updated to support iTerm (2) Added second mapping for backtick -> ctrl-A. This is useful for running an "inner" tmux session on remote shell. You'll need to ensure the remote shell's .tmux.conf is setup for ctrl-A as prefix (https://wiki.archlinux.org/index.php/tmux#Key_bindings) (3) Since we can no longer use backtick key, we need another m…
View private.xml
<?xml version="1.0"?>
<root>
<appdef>
<appname>Terminal</appname>
<equal>com.apple.Terminal</equal>
<equal>iTerm</equal>
<equal>net.sourceforge.iTerm</equal>
<equal>com.googlecode.iterm2</equal>
</appdef>
<item>
@mahemoff
mahemoff / mousetrap-bind.js
Created Nov 6, 2012 — forked from ccampbell/mousetrap-bind.js
Extends mousetrap.js to support passing a dictionary into bind method. Just include this js after you include mousetrap.
View mousetrap-bind.js
/**
* Overwrites default Mousetrap.bind method to optionally accept
* an object to bind multiple key events in a single call
*
* You can pass it in like:
*
* Mousetrap.bind({
* 'a': function() { console.log('a'); },
* 'b': function() { console.log('b'); }
* });
@mahemoff
mahemoff / elasticsearch.rake
Created Sep 19, 2012 — forked from jarosan/elasticsearch.rake
Elasticsearch reindex task
View elasticsearch.rake
# Run with: rake environment elasticsearch:reindex
# Begins by creating the index using tire:import command. This will create the "official" index name, e.g. "person" each time.
# Then we rename it to, e.g. "person20121001" and alias "person" to it.
namespace :elasticsearch do
desc "re-index elasticsearch"
task :reindex => :environment do
klasses = [Place, Person, Caption]
@mahemoff
mahemoff / grunt-wat.js
Created Apr 25, 2012 — forked from cowboy/grunt-wat.js
I'm not even joking.
View grunt-wat.js
// This was what I got, pasted into an email.
// v0.0.0.2 Robust version with namespacing
module.exports = function(grunt) {
//Grunt Globals
com.wtfjs.constants = new Array();
com.wtfjs.constants.ConcatOutputFileNameAndLocation="c:\\TestOutput.js";
com.wtfjs.constants.JavascriptDirectory = 'C:\\Work\\Patch29\\StaticContent\\RootAssets\\JsLib'
com.wtfjs.constants.MessageTaskStart = "StartingTask_";
com.wtfjs.constants.MessageTaskEnd = "EndingTask_";
View LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Sebastien P. https://twitter.com/#!/_sebastienp
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
You can’t perform that action at this time.