Skip to content

Instantly share code, notes, and snippets.

View wwerner's full-sized avatar

Wolfgang Werner wwerner

View GitHub Profile
@kagemusha
kagemusha / gist:1569836
Created January 6, 2012 09:20
Dump Heroku Postgres DB and load locally
Get the Heroku db as detailed here:
http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup
1. heroku pgbackups:capture
2. heroku pgbackups:url <backup_num> #=>backup_url
- get backup_num with cmd "heroku pgbackups"
3. curl -o latest.dump <backup_url>
Then locally do:
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump
@benclark
benclark / default.vcl
Created May 14, 2012 17:17
Varnish config file w/ basic auth
backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
}
acl purge {
"localhost";
@mojavelinux
mojavelinux / slides2png.groovy
Created June 18, 2012 17:27
Export a dzslides presentation to PNGs, then combine into a PDF using geb
/**
* slides2png plays a dzslides presentation using WebDriver, captures each
* slide to a PNG and generates a shell script to collate the PNGs together
* into a PDF using convert (from ImageMagick).
*
* The URL of the presentation is passed as the sole argument to the script.
* If the presentation is local, specify the absolute path prefixed with the
* file:// protocol.
*
* @author Dan Allen
@afair
afair / tmux.cheat
Last active October 11, 2023 13:48
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@cosimo
cosimo / parse-options.sh
Created September 21, 2012 09:31
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"
@robmiller
robmiller / .gitconfig
Created July 17, 2013 07:52
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@hoylen
hoylen / getopt-example.sh
Last active July 23, 2020 11:59
Portable getopt argument processing in shell scripts. Detects which version of getopt is installed. When available, it uses GNU enhanced getopt to support long option names and whitespaces in arguments. Otherwise, defaults to using the original getopt.
#!/bin/sh
#
# Example showing use of getopt detection and use of GNU enhanced getopt
# to handle arguments containing whitespace.
#
# Written in 2004 by Hoylen Sue <hoylen@hoylen.com>
#
# To the extent possible under law, the author(s) have dedicated all copyright and
# related and neighboring rights to this software to the public domain worldwide.
# This software is distributed without any warranty.
@rxaviers
rxaviers / gist:7360908
Last active May 5, 2024 08:25
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 3, 2024 20:51
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@xavriley
xavriley / drum_tab_player.rb
Created June 10, 2014 21:22
Playing ASCII Drum Tabs with Sonic Pi
# Playing ASCII drum tabs with Sonic Pi
# Ruby is an awesome language for String manipulation.
# Lets use that fact to play some drums!
# Tab for the Amen break taken from Wikipedia
# http://en.wikipedia.org/wiki/Amen_break
# Note that %Q{ ... } is just another way
# to define a string in Ruby