Skip to content

Instantly share code, notes, and snippets.

View dryan's full-sized avatar
Black Lives Matter

Dan Ryan dryan

Black Lives Matter
View GitHub Profile
@dryan
dryan / post-merge
Created August 8, 2014 21:38
update dependencies on git merge
#!/bin/bash
if [ -f 'package.json' ];
then
npm install
fi
if [ -f 'bower.json' ];
then
bower install
fi
if [ -f 'requirements.txt' ];
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am dryan on github.
  • I am dryan (https://keybase.io/dryan) on keybase.
  • I have a public key whose fingerprint is 7E76 E4D1 C6A2 B6FD 8D5E 251E 0B1C D282 DD21 7A08

To claim this, I am signing this object:

@dryan
dryan / backup.py
Created January 22, 2014 19:21
Backup a MySQL database and/or a directory of files to S3.
#!/usr/bin/env python
import subprocess, sys, os, zipfile
try:
import boto
except ImportError:
print 'requires boto. `pip install boto`'
sys.exit(os.EX_UNAVAILABLE)
try:
@dryan
dryan / settings.py
Last active September 7, 2023 11:04
Handling EC2 ELB health checks and Django's ALLOWED_HOSTS setting.
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = [
'yourdomain.tld',
'.compute-1.amazonaws.com', # allows viewing of instances directly
]
import requests
EC2_PRIVATE_IP = None
try:
@dryan
dryan / gruntfile.js
Last active December 25, 2015 17:19
gruntfile for watching directory and compiling scss files on save
'use strict';
var
SCSS_ROOT = 'media',
CSS_ROOT = 'media',
SASS_FRAMEWORKS = 'bower_components',
fs = require('fs'),
path = require('path'),
scssFileMap = {},
scssFiles = fs.readdirSync(SCSS_ROOT),
@dryan
dryan / cloud2campfire
Created August 14, 2013 18:31
CLI to put your latest CloudApp image into Campfire chat
#! /usr/bin/env python
import sys, os, ConfigParser, argparse
from getpass import getpass
CLOUD_CONFIG_PATH = os.path.expanduser('~/.cloudapp')
CAMPFIRE_CONFIG_PATH = os.path.expanduser('~/.basecamp')
def log(message, error_code = None):
if error_code:
@dryan
dryan / .bashrc
Last active December 16, 2015 05:29
activate a virtualenv if present on cd. additionally, if a "set_env.sh" file is present with environment variables, load those in.
# add this to the end of your .bashrc, .zshrc or equivalent
function cd() {
builtin cd "$@"
if [ -f "bin/activate" ]
then
source "bin/activate"
elif [ -f "../bin/activate" ]
then
source "../bin/activate"
else
@dryan
dryan / README.md
Last active September 18, 2017 23:15
Script to create redirects in S3 buckets

s3redirect

Authentication

Your AWS credentials can be set in a number of ways:

  1. In a ".boto" file in your home folder. See Boto's documentation for how to create this file.
  2. In the environment variables "AWS_ACCESS_KEY_ID" and "AWS_SECRET_ACCESS_KEY".
  3. Passed in as arguments. -a or --access-key for the Access Key ID and -s or --access-secret for the Secret Access Key.
@dryan
dryan / README.md
Last active December 15, 2015 20:19
Python script for deploying files to S3 with multiple deploy environment support. Moved to http://dryan.github.io/d3ploy.