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
#!/usr/bin/python | |
from time import strftime | |
import sqlite3 | |
import sys | |
import twitter #http://code.google.com/p/python-twitter/ | |
import feedparser #available at feedparser.org | |
DATABASE = "/Users/goerz/.twitter_bot/tweets.sqlite" |
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 os | |
import zipfile | |
cur_path = os.getcwd() | |
filenames = [file for file in os.listdir(cur_path) if file[-3:] == 'zip'] | |
print(filenames) | |
for archive in filenames: | |
myzip = zipfile.ZipFile(archive) |
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 | |
# script location | |
available=/etc/nginx/sites-available | |
enabled=/etc/nginx/sites-enabled | |
sites=/media/psf/Home/Sites | |
www=/var/www | |
if [ ! $1 ] ; then | |
echo "no parameter provided" |
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
# This hosts file is brought to you by Dan Pollock and can be found at | |
# http://someonewhocares.org/hosts/ | |
# You are free to copy and distribute this file for non-commercial uses, | |
# as long the original URL and attribution is included. | |
#<localhost> | |
127.0.0.1 localhost | |
127.0.0.1 localhost.localdomain | |
255.255.255.255 broadcasthost | |
::1 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
#!/usr/bin/env bash | |
# | |
# Nginx - new server block | |
# http://rosehosting.com | |
read -p "Enter username : " username | |
read -p "Enter domain name : " domain | |
# Functions | |
ok() { echo -e '\e[32m'$domain'\e[m'; } # Green | |
die() { echo -e '\e[1;31m'$domain'\e[m'; 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
The regex patterns in this gist are intended only to match web URLs -- http, | |
https, and naked domains like "example.com". For a pattern that attempts to | |
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502 | |
# Single-line version: | |
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s |
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
def download(url, save_to_diretory='.'): | |
def percent(downloaded, total_size): | |
return (math.floor((downloaded / total_size) * 100)) | |
# Open the url | |
try: | |
req = urlopen(url) | |
#handle errors | |
except HTTPError, e: | |
print "HTTP Error:", e.code, url |
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
WEB_DIR='/var/meteor' | |
DIRS=`ls -l --time-style="long-iso" $WEB_DIR | egrep '^d' | awk '{print 8}'` | |
PORT=3000 | |
NGINX_CONF='/etc/nginx/sites-available/meteordev.conf' | |
touch $NGINX_CONF | |
cat << EOF > $NGINX_CONF | |
server { | |
listen 80; | |
server_name meteordev.as.uky.edu; |
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 -e | |
clear | |
echo "============================================" | |
echo "Nginx configuration files" | |
echo "============================================" | |
# Check if the global directory exists | |
DIRECTORY="/etc/nginx/global" | |
if [ ! -d "$DIRECTORY" ]; then | |
# Create the directory |
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 pafy | |
playlist_url = raw_input("Please enter a proper Youtube playlist URL: ") #must be properly formatted like https://www.youtube.com/playlist?list=PL557BC4AF6ABFF637 | |
playlist = pafy.get_playlist(playlist_url) | |
how_many_vids_in_this_playlist = len(playlist['items']) #long variables are fun | |
print "Thanks for the URL, I'm now going to download", how_many_vids_in_this_playlist, "videos" | |
for videos in playlist['items']: |
OlderNewer