Skip to content

Instantly share code, notes, and snippets.

View amackera's full-sized avatar
💭
Hack and /

Anson MacKeracher amackera

💭
Hack and /
View GitHub Profile
@amackera
amackera / .bashrc
Created September 25, 2010 19:57 — forked from henrik/.bashrc
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@amackera
amackera / gist:2239640
Created March 29, 2012 16:40
get_outgoing_number
def get_outgoing_number(provider, incoming_number):
'''
Returns the outgoing number associated with this incoming number.
'''
def get_sms_settings():
# Memcached closure returns outgoing number for this student
try:
settings = SmsSettings.objects.get(phone_number = incoming_number)
except SmsSettings.DoesNotExist:
# Create settings record for this number
@amackera
amackera / .zshrc
Created September 12, 2012 23:49
My .zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="afowler"
# Example aliases
@amackera
amackera / gist:3752753
Created September 19, 2012 22:30
Facepalm
............................................________
....................................,.-'"...................``~.,
.............................,.-"..................................."-.,
.........................,/...............................................":,
.....................,?......................................................,
.................../...........................................................,}
................./......................................................,:`^`..}
.............../...................................................,:"........./
..............?.....__.........................................:`.........../
............./__.(....."~-,_..............................,:`........../
@amackera
amackera / gist:3777540
Created September 24, 2012 18:39
Breakage
SELECT `edumacation_thmlog`.`id`, `edumacation_thmlog`.`user_id`, `edumacation_thmlog`.`message`, `edumacation_thmlog`.`created_at`, `edumacation_thmlog`.`type`, `edumacation_thmlog`.`severity`,
`edumacation_thmlog`.`use_sentry`, `statsconsole_eventlog`.`thmlog_ptr_id`, `statsconsole_eventlog`.`action`, `statsconsole_eventlog`.`course_id`,
`statsconsole_eventlog`.`related_object` FROM `statsconsole_eventlog` INNER JOIN `edumacation_thmlog` ON (`statsconsole_eventlog`.`thmlog_ptr_id` = `edumacation_thmlog`.`id`) WHERE
(`statsconsole_eventlog`.`action` = 'exception' AND `edumacation_thmlog`.`created_at` >= '2009-12-30 18:27:21' ) ORDER BY `edumacation_thmlog`.`created_at` DESC
@amackera
amackera / Procfile
Created October 2, 2012 14:17
Foreman Procfile and supporting scripts
rabbitmq: rabbitmq-server
pushy: pushy
mongodb: mongodb
pingpong: pingpong
cottontail: cottontail
@amackera
amackera / gist:3845274
Created October 6, 2012 15:47
harakiri
*** HARAKIRI ON WORKER 8 (pid: 32233) ***
HARAKIRI: -- wchan> sk_wait_data
*** backtrace of 32233 ***
/usr/local/bin/uwsgi(uwsgi_backtrace+0x29) [0x807ff59]
/usr/local/bin/uwsgi(what_i_am_doing+0x21) [0x80804b1]
[0xb7873400]
/usr/lib/libpython2.6.so.1.0(+0x1283c6) [0xb75ca3c6]
/usr/lib/libpython2.6.so.1.0(PyCFunction_Call+0x112) [0xb7513c92]
/usr/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x49fe) [0xb757445e]
/usr/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x59c1) [0xb7575421]
if (this.model.get('survey_url').indexOf('?') == -1) {
// start the survey URL query string
$(this.el).html('The tournament is complete. To see your rank, please complete <a target="_new" href="'+this.model.get('survey_url')+'?entry_0='+window.user.get('alias')+'&entry_10='+window.user.get('id')+'">this survey.</a>')
} else {
$(this.el).html('The tournament is complete. To see your rank, please complete <a target="_new" href="'+this.model.get('survey_url')+'&entry_0='+window.user.get('alias')+'&entry_10='+window.user.get('id')+'">this survey.</a>')
}
@amackera
amackera / Procfile
Created October 29, 2012 15:11
Procfile
#rabbitmq: rabbitmq-server
#pushy: pushy
mongodb: mongodb
pingpong: pingpong
cottontail: cottontail
celery: python manage.py celeryd -E
celery_socket_reqs: python manage.py celeryd -E -Q socket_reqs
celery_highest_priority: python manage.py celeryd -E -Q highest_priority
celery_priority: python manage.py celeryd -E -Q priority
@amackera
amackera / gist:4115606
Created November 20, 2012 02:46
wtfquery
SELECT `auth_user`.`id`, `auth_user`.`username`, `auth_user`.`first_name`, `auth_user`.`last_name`, `auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`, `auth_user`.`is_active`, `auth_user`.`is_superuser`, `auth_user`.`last_login`, `auth_user`.`date_joined`, `accounts_thmuser`.`user_ptr_id`, `accounts_thmuser`.`key_str`, `accounts_thmuser`.`role`, `accounts_thmuser`.`created_date`, `accounts_thmuser`.`last_active`, `accounts_thmuser`.`logged_in`, `accounts_thmuser`.`student_id`, `accounts_thmuser`.`course_passwords`, `accounts_thmuser`.`current_ip_address`, `accounts_thmuser`.`is_anonymous_account`, `accounts_thmuser`.`phone_number`, `accounts_thmuser`.`verified`, `accounts_thmuser`.`clicker_id`, `accounts_thmuser`.`clicker_checksum`, `accounts_thmuser`.`department_id`, `accounts_thmuser`.`org_id`, `accounts_thmuser`.`subscription_id`, `accounts_thmuser`.`current_course_id`, `accounts_thmuser`.`weekly_notification_email`, `accounts_thmuser`.`alias` FROM `accounts_thmuser` INNER JOIN `course_co