Skip to content

Instantly share code, notes, and snippets.

@bewest
bewest / index.html
Created August 19, 2011 17:30 — forked from mbostock/.block
Polymaps + D3
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/v1.8.4/d3.js"></script>
<script type="text/javascript" src="https://github.com/simplegeo/polymaps/raw/v2.4.0/polymaps.js"></script>
<style type="text/css">
@import url("http://github.com/simplegeo/polymaps/raw/v2.4.0/examples/example.css");
html, body {
@bewest
bewest / index.html
Created August 20, 2011 21:51 — forked from hperantunes/index.html
hexagons map
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Hexagons Test</title>
<script type="text/javascript" src="http://hperantunes01.appspot.com/static/js/d3/d3.min.js"></script>
<script type="text/javascript" src="http://hperantunes01.appspot.com/static/js/d3/d3.behavior.min.js"></script>
<style type="text/css">
svg {
border: solid 1px #aaa;
@bewest
bewest / index.html
Created August 24, 2011 21:23 — forked from mbostock/.block
Axis Component
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.csv.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?2.0.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;
@bewest
bewest / index.html
Created September 2, 2011 02:30 — forked from stepheneb/index.html
D3 Example: spline, zoom and pan
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Spline + Pan</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<style type="text/css">
body {
font: 13px sans-serif;
}
@bewest
bewest / index.html
Created January 6, 2012 17:19 — forked from mbostock/.block
d3.geo.tiler
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/v1.8.4/d3.js"></script>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/v1.8.4/d3.geo.js"></script>
<script type="text/javascript" src="https://github.com/simplegeo/polymaps/raw/v2.4.0/polymaps.js"></script>
<script type="text/javascript" src="tiler.js"></script>
<style type="text/css">
@import url("http://github.com/simplegeo/polymaps/raw/v2.4.0/examples/example.css");
body {
font-family: Helvetica, Verdana
}
p {
padding: 7px 10px;
}
#demo {
border: 1px solid #999;
}

Rename some files

find the files like this: find ./ -type f -name "*.mp3"

Pipe them into a loop: help read help while

@bewest
bewest / snippet.py
Created October 9, 2012 07:13 — forked from n-west/gist:3857129
decode chunk modifications
def decode_chunk(chunk):
"""
Experiment: decode a chunk!
<snip>
"""
# give ourselves a copy of this record as a bytearray to sanitize things a bit.
record = bytearray(chunk)
if chunk == 0x1f:
try:
print hex(record)
@bewest
bewest / node-on-ec2-port-80.markdown
Created October 17, 2012 07:21 — forked from kentbrew/node-on-ec2-port-80.md
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);