Skip to content

Instantly share code, notes, and snippets.

@WilliamQLiu
WilliamQLiu / index.html
Created July 30, 2014 20:13
D3 Scatterplot
<!DOCTYPE html>
<html>
<head>
<!-- Load D3 from site -->
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<!-- CSS (Styling) -->
<style type="text/css">
.axis path,
@WilliamQLiu
WilliamQLiu / index.html
Last active August 29, 2015 14:04
D3 Bar Chart (Animations)
<!DOCTYPE html>
<html>
<head>
<!-- Load D3 from site -->
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<!-- Tooltip CSS Styling -->
<style type="text/css">
@WilliamQLiu
WilliamQLiu / gist:97e3c1732201178604db
Created August 4, 2014 15:31
Sublime Text 3 Default Text Editor on Mac
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'
@WilliamQLiu
WilliamQLiu / sample_pycrypto.py
Created August 12, 2014 20:32
Quick Obfuscation in Python
from Crypto.Cipher import AES
from base64 import b64encode, b64decode
import os
BLOCK_SIZE = 32 # Block size for the cipher object must be 16, 24, 32 for AES
PADDING = '*'
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING
@WilliamQLiu
WilliamQLiu / index.html
Created November 17, 2014 20:31
D3 Autoscaling Axis
<!DOCTYPE html>
<!-- Allows creating new values outside the normal scale
Then updates axis, scales, and circle attributes -->
<html>
<head>
<!-- Load D3 from site -->
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<!-- CSS (Styling) -->
@WilliamQLiu
WilliamQLiu / index.html
Created November 18, 2014 21:30
D3 Colors
<!DOCTYPE html>
<!-- D3 has a lot of neat ways to manipulate color
https://github.com/mbostock/d3/wiki/Colors -->
<html>
<head>
<!-- Load D3 from site -->
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<!-- CSS (Styling) -->
<style type="text/css">
@WilliamQLiu
WilliamQLiu / index.html
Created November 18, 2014 21:35
D3 Basic Template
<!DOCTYPE html>
<!-- D3 Template, can run with: python -m SimpleHTTPServer 8000
Reference: https://github.com/mbostock/d3/wiki/API-Reference
-->
<html>
<head>
<!-- Load D3 from site -->
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
@WilliamQLiu
WilliamQLiu / index.html
Created November 18, 2014 21:36
D3 Blank Template
<!DOCTYPE html>
<html>
<head>
<!-- Load D3 from site -->
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<!-- CSS (Styling) -->
<style type="text/css">
</style>
@WilliamQLiu
WilliamQLiu / countlines
Created January 10, 2015 16:34
Linux - Count number of lines in file
wc -l <myfile> # Example output: 4577465 myfile.csv
@WilliamQLiu
WilliamQLiu / csvkit_tutorial
Last active August 29, 2015 14:13
Useful csvkit commands
# From https://csvkit.readthedocs.org
# Shows you stats about the file (e.g. col names, type, nulls, min, max, median, std deviation, unique values, most frequent)
$csvstat myfile.csv
# Peak at excel file to display in terminal
$in2csv myfile.xlsx
$in2csv myfile.xlsx > myfile.csv # can write xlsx file to csv by chaining operations
# Look at data, formats nicely with borders