Skip to content

Instantly share code, notes, and snippets.

@peterc
peterc / redis-server-for-init.d-startup
Created May 21, 2010 12:13 — forked from lsbardel/redis-server-for-init.d-startup
Redis init.d file for Ubuntu/Debian
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
#!/usr/bin/env sh
source "$HOME/.rvm/scripts/rvm"
rvm default
__rvm_load_rvmrc
cd .
export BUNDLE_PATH=$GEM_HOME
exec ruby "$@"
@ryanb
ryanb / favorite_gems.md
Created March 4, 2011 17:31
A list of my favorite gems for various tasks.
@apalmblad
apalmblad / fast-require-ruby-19.2-p180
Created May 30, 2011 20:46
fast require, ruby 1.9.2-180
diff --git a/array.c b/array.c
index b1616c5..16326fc 100644
--- a/array.c
+++ b/array.c
@@ -302,7 +302,7 @@ ary_alloc(VALUE klass)
return (VALUE)ary;
}
-static VALUE
+VALUE
@thomasjachmann
thomasjachmann / gist:1173001
Created August 26, 2011 08:50
restore lost git commits
#!/usr/bin/env ruby
# Helps recovering lost commits, eg when you've:
# - dropped a stash
# - reset a branch to an earlier commit, dropping the changes with --hard
#
# Shows which files have been changed in which dangling commit and prints
# the commands to view details of and restore a commit.
#
# When given a parameter, only lists commits that changed a file matching
@peterc
peterc / dnsd.rb
Created December 2, 2011 23:47
Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
#
# MIT license
#
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance
# * All records get the same TTL
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
@ttscoff
ttscoff / rmdbc.bash
Created August 2, 2012 17:12
Bash alias to recursively delete Dropbox conflicted files
alias rmdbc="find . -name *\ \(*conflicted* -exec rm {} \;" # recursively delete Dropbox conflicted files
# and/or (smart idea from Gordon Fontenot)
alias rmdbcsafe="find . -name *\ \(*conflicted* -exec mv {} ~/DropboxConflicts/ \;" # recursively move Dropbox conflicted files to temp folder
# or... via TJ Luoma
alias rmdbctrash="find . -name *\ \(*conflicted* -exec mv -v {} ~/.Trash/ \;" # recursively move Dropbox conflicted files to Trash
# More advanced idea combining ideas from @modernscientist and @GFontenot would be
# Hazel or launchd script to move conflicted files to temp folder once a day, and Hazel or launchd script to delete files older than [x]
# Or schedule TJ's idea of moving to Trash and skipping intermediate folder while still maintaining the ability to review
# hmmmm...
@agnoster
agnoster / README.md
Last active July 13, 2024 19:26
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@ttscoff
ttscoff / init.lua
Last active January 9, 2024 23:44
Hammerspoon config examples for hyper key
-- A global variable for the Hyper Mode
k = hs.hotkey.modal.new({}, "F17")
-- Trigger existing hyper key shortcuts
k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end)
-- OR build your own
launch = function(appname)