View 0_reuse_code.js
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View plot99.py
#!/usr/bin/env python | |
import argparse | |
import datetime | |
import matplotlib as mpl | |
mpl.use('Agg') | |
import matplotlib.pyplot as plt | |
import numpy | |
import os | |
import re |
View iperf.sh
#!/bin/bash | |
PORT=50000 | |
TIME=60 | |
print_usage () { | |
echo "Usage: ./iperf.sh [-s|-c destination] [-h] [-p port] [-t time] -k total_packets_per_sec" | |
echo " -h|--help : Print usage." | |
echo " -s : Server mode which receives the data." | |
echo " -c : Client mode which sends the data. Requires destination." |
View ping.sh
#!/bin/bash | |
COUNT=450 | |
INTERVAL=2 | |
THRESHOLD=5 | |
print_usage () { | |
echo "Usage: ./ping.sh [-h] [-c count] [-i interval] [-t threshold] -d destination" | |
echo " -h|--help : Print usage." | |
echo " -c|--count : Number of pings to send. Default 450." |
View backup.sh
#!/bin/bash | |
# Backup folders to DropBox | |
# Add folder names relative to home directory. | |
# This file exists at the home directory level. | |
DATE=`date +%Y-%m-%d-%H-%M` | |
FOLDERS=("minecraft") | |
DROPBOX="/home/richardhsu/.dropbox/dropbox.py" | |
for dir in "${FOLDERS[@]}" |
View git_log_first_email.sh
#!/bin/bash | |
# Set up a repos.txt file that contains a list of all the repos | |
# one repo per line. Then create an emails.txt file which is where | |
# all the emails will go. It'll be a CSV file so you can verify. | |
# This is a quick hacky way to get emails, not sure if I covered all | |
# valid characters in regex but didn't need precision. Feel free to | |
# make it better! | |
reponame="https://github.com/[a-zA-Z0-9._-]+/([a-zA-Z0-9._-]+)$" | |
email="<([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.\w+)>" |
View ssa_names_by_state.py
#!/usr/bin/env python3 | |
import urllib.request | |
import urllib.parse | |
url = 'http://www.ssa.gov/cgi-bin/namesbystate.cgi' | |
post_data = { | |
'state': 'IL', | |
'year': '2012' | |
} |
View send_post.py
#!/usr/bin/env python | |
import json | |
import urllib, urllib2 | |
# URL and Data to Send | |
url = 'http://localhost/api/table_name' | |
values = { 'user': 'username', | |
'count': 5, | |
'status': False } |
View google_linechart_update.js
// Google Chart Visualization Playground's LineChart Example | |
function drawVisualization() { | |
// Create and populate the data table. | |
var data = google.visualization.arrayToDataTable([ | |
['x', 'Data 1', 'Data 2', 'Data 3'], | |
[1, 1, 1, 0.5], | |
[2, 2, 0.5, 1], | |
[3, 4, 1, 0.5], | |
[4, 8, 0.5, 1], | |
[5, 7, 1, 0.5], |
View so_xml2sql.py
#!/usr/bin/env python | |
""" Stack Overflow XML 2 SQL | |
The following is a custom made XML 2 SQL converter for Stack Overflow data. | |
Latest Stack Overflow Data: August 2012 | |
Call Examples: |