Skip to content

Instantly share code, notes, and snippets.

@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active June 8, 2020 03:24
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@nhocki
nhocki / gist:1095522
Created July 20, 2011 18:11 — forked from croaky/gist:1089598
Transfer data from production to staging on Heroku
heroku addons:add pgbackups --remote staging
heroku addons:add pgbackups --remote production
heroku pgbackups:capture --remote production
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging
@t2
t2 / birthday_liker.rb
Last active September 23, 2016 14:10
Like and Comment on every 'Happy Birthday' post on your Facebook feed at once.
require 'date'
require 'koala'
class BirthdayLiker
FACEBOOK_TOKEN = 'your_oauth_key'
BIRTHDAY_WORDS = %w(birthday bday birfday birth born)
THANKS_OPTIONS = ['Thank you!', 'Thanks!', 'Appreciate it!']
DATE_TIME_FORMAT = '%Y-%m-%d'
def initialize(birthdate, opts={})
@indec
indec / switch_audio.applescript
Last active December 17, 2015 21:09
An Applescript to cycle the audio input and output sources between two (or more) audio devices
on alfred_script(q)
set output_devices to {"Display Audio", "Generic USB Audio Device "}
set input_devices to {"Display Audio", "Generic USB Audio Device "}
set device_keywords to {"speakers", "headphones"}
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
tell application "System Events"
tell process "System Preferences"
#!/usr/bin/env ruby
# serve the contents under www/ with a web server via port 8080 and proxy all
# requests to /api/* to an external API
# Steven Wilkin | @stevebiscuit
require 'net/http'
require 'webrick'
require 'uri'