Skip to content

Instantly share code, notes, and snippets.

Richard Hsu richardhsu

Block or report user

Report or block richardhsu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
richardhsu / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
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
richardhsu /
Created Nov 11, 2014
Ping 99% Latencies
#!/usr/bin/env python
import argparse
import datetime
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy
import os
import re
richardhsu /
Last active Dec 5, 2018
IPerf to send specific number of packets per second.
print_usage () {
echo "Usage: ./ [-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."
richardhsu /
Last active Aug 29, 2015
Ping with timestamp and threshold.
print_usage () {
echo "Usage: ./ [-h] [-c count] [-i interval] [-t threshold] -d destination"
echo " -h|--help : Print usage."
echo " -c|--count : Number of pings to send. Default 450."
richardhsu /
Created May 31, 2014
Quick backup script to backup my minecraft server folder and potentially other folders to Dropbox.
# 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`
for dir in "${FOLDERS[@]}"
richardhsu /
Created Apr 9, 2014
Bash script to pull git repositories, clone them, view log and grab the first email address seen.
# 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!
richardhsu /
Created Jan 26, 2014
Request Page from SSA for Names By State with Python 3 and urllib.
#!/usr/bin/env python3
import urllib.request
import urllib.parse
url = ''
post_data = {
'state': 'IL',
'year': '2012'
richardhsu /
Last active Dec 18, 2015
Submitting a JSON post request in Python with an `application/json` type.
#!/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 }
richardhsu / google_linechart_update.js
Created May 30, 2013
Google Charts LineChart example with updating.
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],
richardhsu /
Created Dec 13, 2012
XML to SQL converter for Stack Overflow XML data dump files. For newer versions of MySQL you can use the LOAD XML and it can work out but for older versions this script can help.
#!/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:
You can’t perform that action at this time.