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
| angular.module('todoApp').factory 'Task', ($resource) -> | |
| class Task | |
| constructor: (taskListId) -> | |
| @service = $resource('/api/task_lists/:task_list_id/tasks/:id', | |
| {task_list_id: taskListId, id: '@id'}) | |
| create: (attrs) -> | |
| new @service(task: attrs).$save (task) -> | |
| attrs.id = task.id | |
| attrs |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <!-- Generated by: TmTheme-Editor --> | |
| <!-- ============================================ --> | |
| <!-- app: http://tmtheme-editor.herokuapp.com --> | |
| <!-- code: https://github.com/aziz/tmTheme-Editor --> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>author</key> | |
| <string>Allen Bargi</string> |
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
| #!/bin/sh | |
| # | |
| # this post-update hook shows how individual directories | |
| # from a larger project can be exported to the /var/www directory | |
| echo | |
| echo "*** deploying to /var/www" | |
| git archive master sims | (cd /var/www; tar -x) | |
| echo "*** restarting apache2" | |
| service apache2 restart |
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
| # set count=2048 to whatever size you want, in Megabytes (2048 = 2GB swap) | |
| # location of file is /var/swapfile | |
| sudo dd if=/dev/zero of=/var/swapfile bs=1M count=2048 && | |
| sudo chmod 600 /var/swapfile && | |
| sudo mkswap /var/swapfile && | |
| echo /var/swapfile none swap defaults 0 0 | sudo tee -a /etc/fstab && | |
| sudo swapon -a | |
| # to turn off swap (remove for /etc/fstab as well) | |
| sudo swapoff -a |
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
| # set this to your head node hostname (run hostname) | |
| HEAD_NODE_NAME=master | |
| if [ `hostname` = $HEAD_NODE_NAME ]; then | |
| NODES=`qconf -sel | grep -v $HEAD_NODE_NAME` | |
| for NODE in $NODES; do | |
| SCRIPT_PATH=`readlink -f $0` | |
| qsub -l h=$NODE $SCRIPT_PATH | |
| done |
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 time | |
| from functools import wraps | |
| def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None): | |
| """Retry calling the decorated function using an exponential backoff. | |
| http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/ | |
| original from: http://wiki.python.org/moin/PythonDecoratorLibrary#Retry |
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
| # first, you need to disable the host from queue to avoid any jobs to be allocated to this host | |
| qmod -d [email protected] | |
| # wait for jobs to be finished execution on this host, then kill the execution script | |
| qconf -ke thishost.com | |
| # remove it from the cluster, this opens an editor, just remove the lines referring to this host | |
| qconf -mq all.q | |
| # remove it from allhosts group, this also opens an editor, remove lines referring to this host | |
| qconf -mhgrp @allhosts | |
| # remove it from execution host list | |
| qconf -de thishost |
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
| alias topy='tmux attach -t topy || tmux new-session -s topy -d "htop" \; rename-window htop \; split-window -v -p 15 "iotop -o" \; attach -t topy' |
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
| # some code... | |
| import IPython; IPython.embed() | |
| # more code... |
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
| def merge_intervals(df, start_col="start", stop_col="stop"): | |
| out = [] | |
| df = df.sort(start_col) | |
| first_row = True | |
| for ix, row in df.iterrows(): | |
| if first_row: | |
| current_start = row[start_col] | |
| current_stop = row[stop_col] | |
| first_row = False | |
| start = row[start_col] |