Skip to content

Instantly share code, notes, and snippets.

View nfelger's full-sized avatar

Niko Felger nfelger

View GitHub Profile
require 'sequel'
class Configuration
# ... logic for finding configuration strings for different environments / applications.
def self.datastore
@datastore ||= Sequel.connect(connection_uri)
end
end
require 'rubygems'
require 'fsevents'
STDOUT.sync = true
project = ARGV[0] || 'skweb'
options = {
:directory_to_watch => "/Users/nfelger/dev/songkick/#{project}",
:remote_host => 'of1-dev-nfelger',
Anything from http://www.martinkahr.com/2006/02/13/mac-keys-for-eclipse/, so:
Command-Left/Right: Beginning/end of line
Command-Up/Down: Beginning/end of document
Option-Left/Right: Previous/next word
Option-Up/Down: Page up/down
Option-Page up/Page down: Page up/down
Command-G: Find next
Command-Shift-G: Find previous
Plus:
#!/bin/sh
# Take the command to execute from the command line.
command=$@
# Default to updating the project if no command given.
[ -z "$command" ] && command='git pull --rebase ; git submodule init && git submodule update'
# Colors.
boldgreen=$(tput bold)$(tput setaf 2)
colorreset=$(tput sgr0)
@nfelger
nfelger / gist:4329505
Created December 18, 2012 16:35
Download all your Instagram snaps.
@nfelger
nfelger / movietize.sh
Created January 26, 2013 19:45
Script to make a movie from some 480x640 pixel JPGs, and imprint the images with their creation date (OSX only).
#!/bin/bash
# Image sequence counter. Makes the ffmpeg command simpler.
imgNr=0
# Clear any previously generated intermediate files.
rm -rf dated rotated
mkdir dated
mkdir rotated
@nfelger
nfelger / gist:5221574
Created March 22, 2013 14:14
get commit messages
require 'grit'
root_dir = "/some/path"
terms = ['niko', 'nfelger']
Dir[root_dir + "/*/.git"].each do |dir|
repo = Grit::Repo.new(dir)
File.open("/where/ever/commit_messages/#{dir.split('/')[-2]}", 'w') do |file|
step = 100
var myModule = angular.module('myModule', []);
myModule.run(function() {
jQuery.ajax({
method: 'GET',
url: '/foo',
dataType: 'json',
async: false,
success: function (data) {
...
@nfelger
nfelger / com.whatever.dailylinks.plist
Created November 1, 2013 08:11
Using AppleScript and launchd to open a bunch of URLs every morning when I get into work. (Why not just a shell script in cron? If your Mac is asleep when the run is scheduled, launchd will run it when you next wake it from sleep.)
@nfelger
nfelger / get_from_domains.py
Created February 4, 2015 12:08
Get all domains an mbox has received email from
import mailbox
from collections import defaultdict
from flanker import mime
from flanker.addresslib import address
mbox_path = '...'
mbox = mailbox.mbox(mbox_path)
domains = defaultdict(int)