Skip to content

Instantly share code, notes, and snippets.

Avatar

John Wu tjwudi

View GitHub Profile
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>D3 Playground</title>
</head>
<body>
<div id="display"></div>
<script src="//cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/d3js/3.5.5/d3.min.js"></script>
View brush.js
if(!d3.chart) d3.chart = {};
d3.chart.brush = function() {
var g;
var data;
var width = 600;
var height = 30;
var dispatch = d3.dispatch(chart, "filter");
function chart(container) {
View bookmarks
icecomm.io|webrtc
@tjwudi
tjwudi / index.html
Created May 20, 2015
Fast prototyping with gist
View index.html
<html>
<head></head>
<body>
A demo page for fast prototyping.
</body>
</html>
View .gitconfig
[alias]
s = status
co = checkout
p = push
c = commit
a = add
aa = add -A
ap = add -p
@tjwudi
tjwudi / main.yml
Created Oct 14, 2015 — forked from rothgar/main.yml
Generate /etc/hosts with Ansible
View main.yml
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
View gist:3d1f98981e52a387015b
++ timestamp
+++ date +%s.%N
++ echo 1448231881.012023753
+ scriptstarttime=1448231881.012023753
+ readonly INTERNAL_ERROR_CODE=123
+ INTERNAL_ERROR_CODE=123
+ exist_file_or_die /mnt/prog_joined.js
+ local file=/mnt/prog_joined.js
+ '[' '!' -f /mnt/prog_joined.js ']'
+ exist_file_or_die /mnt/data.in
@tjwudi
tjwudi / vim-bullet-points.md
Last active Nov 23, 2015
Vim Bullet Points
View vim-bullet-points.md

Command Mode

  • 'a' - append after the cursor
  • 'A' - append at the end of current line

Commands

  • :vimgrep can help you to search through multiple files. It also tells you where you are now in the search. You can use :copen to see all matches.
  • :vnew Open an empty buffer as a vertical split
  • :%s/old/new/gc Replace all old with new throughout file with confirmations