This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import httplib2 | |
from apiclient.discovery import build | |
from oauth2client.client import AccessTokenCredentials | |
def connect_helper(user): | |
c = user.social_auth.get(provider='google-oauth2') | |
access_token = c.tokens['access_token'] | |
credentials = AccessTokenCredentials(access_token, 'my-user-agent/1.0') | |
http = httplib2.Http() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BITRATE=320 | |
defvalue='.' | |
SOURCE_DIR=${1:-$defvalue} | |
# Validate arguments | |
if [[ "$#" == 0 ]]; then | |
echo >&2 "Usage: ./convert.sh ./exports/*.wav" | |
exit 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
watchmedo shell-command \ | |
--pattern="*prof" \ | |
--ignore-pattern="*png" \ | |
--wait \ | |
--command='find profile_data -name "*\.prof" -exec sh -c "test -f {}.png || (gprof2dot -f pstats {} | dot -Tpng -o {}.png && open {}.png)" \;' \ | |
profile_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: johnd | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start daemon at boot time | |
# Description: Enable service provided by daemon. | |
### END INIT INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Send a SIGHUP to only the children (--ppid is the magic param here). | |
cat /var/run/celery.pid | xargs ps --no-headers --ppid | awk '{print $1}' | xargs kill -HUP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A pretty nice time parsing regex. | |
@author Richard Caceres, @rchrd2 | |
""" | |
import re | |
# The history for this regex is stored in my gist | |
# https://gist.github.com/rchrd2/9773922 | |
time_range_regex = re.compile(r''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run with "foreman start" | |
gulp: gulp | |
server: sh -c 'cd public && python -m SimpleHTTPServer 9876' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install NTP for clock syncing | |
apt-get install -y ntp | |
/etc/init.d/ntp start | |
# Install Puppet from official packages | |
cd | |
mkdir source | |
cd source | |
sudo wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb | |
sudo dpkg -i puppetlabs-release-precise.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple configuration file for monitoring the local host | |
# This can serve as an example for configuring other servers; | |
# Custom services specific to this host are added here, but services | |
# defined in nagios2-common_services.cfg may also apply. | |
# | |
define host{ | |
use generic-host ; Name of host template to use | |
host_name localhost | |
alias localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A simple nagios check for Redis set length | |
# | |
# It doesn't require any redis libraries and uses the raw api | |
# | |
# @author Richard Caceres (me@rchrd.net) | |
# @license MIT | |
# @example check_redis_llen -c 50 -w 10 -k celery -h localhost -p 6379 | |
# Parse -c -w args |
OlderNewer