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 bash | |
# This hook is run after a new virtualenv is activated. | |
# ~/.virtualenvs/postmkvirtualenv | |
# determine if virtualenv is activated | |
python -c 'import sys; print(sys.real_prefix)' 2>/dev/null && INVENV=1 || INVENV=0 | |
if [ ! $INVENV == 1 ]; then | |
echo "You must activate a virtualenv for this to work." | |
exit -1 | |
fi |
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 urllib2 | |
import numpy as np | |
url = 'http://www.lifehack.org/articles/lifestyle/30-best-workout-songs-keep-you-pumped.html' | |
output_file = 'workout_songs' | |
split_str = 'src=' | |
youtube_link = 'http://www.youtube.com' | |
response = urllib2.urlopen(url) |
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
Got this from: https://help.ubuntu.com/community/IptablesHowTo | |
IPTables setup, which will load and save configurations made in IPTables. | |
This default setup will block every port except for 80 and 22. | |
First create the files below in | |
/etc/iptables.rules | |
/etc/network/if-post-down.d/iptablessave | |
/etc/network/if-pre-up.d/iptablesload |
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 | |
# btsync service | |
# Replace with linux users you want to run BTSync clients for | |
BTSYNC_USERS="mendel" | |
DAEMON=/usr/bin/btsync | |
start() { | |
for btsuser in $BTSYNC_USERS; do | |
HOMEDIR=`getent passwd $btsuser | cut -d: -f6` | |
config=$HOMEDIR/.sync/config.json |
NewerOlder