This file contains hidden or 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
#!/usr/bin/env python | |
# active-celery.py --- get the active tasks being processed from celery and | |
# sort by how long they have been running (descending) | |
from celery import Celery | |
from time import time | |
if __name__ == '__main__': | |
celery = Celery('monitoring') |
This file contains hidden or 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 boto | |
ec2 = boto.connect_ec2() | |
key_pair = ec2.create_key_pair('ec2-sample-key') # only needs to be done once | |
key_pair.save('/Users/patrick/.ssh') | |
reservation = ec2.run_instances(image_id='ami-bb709dd2', key_name='ec2-sample-key') | |
# Wait a minute or two while it boots | |
for r in ec2.get_all_instances(): | |
if r.id == reservation.id: | |
break |
This file contains hidden or 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
from celery import Celery | |
celery = Celery('tasks', backend='amqp', | |
broker='amqp://guest:guest@localhost:5672/md5') | |
class Borked(Exception): | |
pass | |
@celery.task | |
def add(x, y): |
This file contains hidden or 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
compile: | |
find -name \*.el -type f -exec emacsclient.emacs-snapshot --eval "(byte-compile-file \"${PWD}/{}\")" ';' |
This file contains hidden or 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
;; http://httpbin.org/get?x=1 | |
;; eval this buffer | |
(url-retrieve (buffer-substring-no-properties 4 30) (lambda (&rest args) (switch-to-buffer (current-buffer)))) |
This file contains hidden or 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
#!/usr/bin/env python | |
# an rpn calculator in python | |
# > 19 2.14 + 4.5 2 4.3 / - * | |
# [85.297441860465113] | |
# only supports two operands and then an operator | |
import operator | |
ops = { '+': operator.add, |
This file contains hidden or 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
# Look back 7 days for files to deliver via FTP | |
back_date = datetime.datetime.now() - (datetime.timedelta(days=15)) |
This file contains hidden or 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
t = time.gmtime(epoch) | |
return time.strftime('%Y-%m-%d', t)p |
This file contains hidden or 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
;;; elpa-autoload.el -- install a base set of package automatically | |
;;; lifted from emacs-starter-kit | |
;;; http://github.com/technomancy/emacs-starter-kit/raw/master/starter-kit-elpa.el | |
(defvar ssm-kit-packages (list 'anything | |
'anything-config | |
'full-ack | |
'gist | |
'htmlize | |
'json |
This file contains hidden or 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
(message "Loading package.el") | |
(when | |
(require 'package | |
(expand-file-name "~/.emacs.d/lisp/package.el") 'noerror) | |
(add-to-list 'package-archives '("marmalade" | |
. "http://marmalade-repo.org/packages/")) | |
(add-to-list 'package-archives '("org-odt" . "http://repo.or.cz/w/org-mode/org-jambu.git/blob_plain/HEAD:/packages/")) | |
(package-initialize) | |
(load (expand-file-name "~/.emacs.d/common/elpa-autoload.el"))) |