Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# gpgsig, a little script to sign your gpg/pgp keys
#
# Copyright 2006,2013 Aron Griffis <agriffis@n01se net>
# Released under the GNU GPL v2
#
# Based loosely on ideas Damien Chrisment's gpgsig, but written from scratch to
# be simpler and just do what I need. Simply:
#
@agriffis
agriffis / stdout.py
Created April 22, 2013 21:07
Patch Python's sys.stdout and sys.stderr to honor locale variables regardless of tty, and fall back to UTF-8 instead of ASCII in the absence of more information.
"""
Patch Python's sys.stdout and sys.stderr to encode to UTF-8
The short story is that sys.stdout.encoding is set based on the environment
variable LC_CTYPE (or LANG/LC_ALL) but only when stdout.isatty().
Otherwise those variables are ignored and stdout has no encoding, and it
CANNOT be set.
The long story is here (especially in the comments):
http://drj11.wordpress.com/2007/05/14/python-how-is-sysstdoutencoding-chosen/
@agriffis
agriffis / wait_for_it.bash
Last active December 16, 2015 14:59
wait_for_it.bash 30m deploy
#!/bin/bash
sleep_for=$1
shift
(
"$@"
status=$?
if [[ $status == 0 ]]; then
from django.core.cache import get_cache
class KeyedCache(object):
"""
Proxied cache object to allow objects to implement their own keying,
for example a Django model can implement per-row caching with:
def cache_key(self, key):
return '{}.{}.{}'.format(self.__class__.__name__, self.pk, key)
@agriffis
agriffis / gist:8240913
Last active January 2, 2016 02:59
Chrome vs. Firefox
@agriffis
agriffis / keybase.md
Created October 29, 2016 00:48
keybase.md

Keybase proof

I hereby claim:

  • I am agriffis on github.
  • I am agriffis (https://keybase.io/agriffis) on keybase.
  • I have a public key ASAG-vNw34R-v-jUZ7WrUrAU7E0UD16csjTPJMRQegh-sgo

To claim this, I am signing this object:

@agriffis
agriffis / bread.md
Last active December 18, 2016 22:16
bread recipe

Wheat Bread

  • 1 package (1/4 oz) active dry yeast
  • 2¼ cups warm water (115°F)
  • 2 Tbsp sugar
  • 1 Tbsp salt
  • 2 Tbsp safflower oil
  • 2½ cups bread flour
  • 2½-3 cups whole wheat flour
@agriffis
agriffis / settings.py
Last active February 4, 2017 22:06
envbash/bienvenue example
from bienvenue import make_env_reader
from envbash import load_envbash
# Where are we?
DREAMHOST = 'dreamhost' in open('/etc/resolv.conf').read()
DEVELOPMENT = not DREAMHOST
# Load env.bash
if DREAMHOST:
load_envbash(os.path.expanduser('~/env.bash'))
INFO global: Vagrant version: 1.8.5
INFO global: Ruby version: 2.3.3
INFO global: RubyGems version: 2.5.2
INFO global: VAGRANT_EXECUTABLE="/usr/share/vagrant/bin/vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/var/lib/vagrant"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1"
INFO global: VAGRANT_DETECTED_OS="Linux"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_LOG="debug"
#!/bin/sh
sudo enter-chroot -u root -b sh -c '
install -d -m 0755 /var/run/sshd
/usr/sbin/sshd -D
'