Skip to content

Instantly share code, notes, and snippets.

@JoshAshby
JoshAshby / README.md
Last active December 20, 2015 07:09 — forked from jasondavies/README.md

Based on Mike Bostock’s [World Map][0], modified to automatically colour countries such that no adjacent countries share the same colour.

This is done by extracting the topology via [TopoJSON][1] and greedily picking colours until the constraint is fulfilled.

See also: [Graph coloring][2] on Wikipedia.

Update: Greedily colouring is now performed in a single line, thanks to Mike Bostock!

#Never done email in python however this seemed to work on my VPS with it's smtp server...
import smtplib
from email.mime.text import MIMEText
msg = MIMEText("This is a test")
msg['Subject'] = "test"
msg['To'] = "joshuaashby@joshashby.com"
msg['From'] = 'loki'
s = smtplib.SMTP('localhost')
keycode 66 = Control_L
clear lock
add Control = Control_L
keycode 49 = asciitilde grave
keycode 135 = asciitilde
pointer = 1 2 3 5 4 7 6 9 8 10 11 12
@JoshAshby
JoshAshby / specs
Created August 17, 2012 02:07
specs
CPU:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 28
model name : Intel(R) Atom(TM) CPU N455 @ 1.66GHz
stepping : 10
microcode : 0x105
cpu MHz : 1000.000
cache size : 512 KB
module beginner(pin1, pin2, ledpin);
input pin1;
input pin2;
output ledpin;
wire pin1and2 = (pin1 & pin2);
assign ledpin = pin1and2;
endmodule
@JoshAshby
JoshAshby / .bashrc.screenrc.Xmodmap.vimrc
Created May 16, 2012 22:00
So i don't forget to add these
##.bashrc
alias ack="ack-grep"
alias normScreen="screen -RaAd -S josh-dev"
alias www="cd /var/www/"
alias v="vim"
alias vg="gvim"
##.Xmodmap
keycode 66 = Control_L
@JoshAshby
JoshAshby / snippet.py
Created December 3, 2011 22:30
Quick little think about "streaming" data with web.py
'''
This is in a POST/PUT API call which receives a picture (part of my House-Inventory-API)
built with web.py
pic is defined earlier in the program as:
bobbins= web.input(picture={})
pic = bobbins['picture']
and f:
@JoshAshby
JoshAshby / dump.json
Created November 7, 2011 03:13
backup from my failing harddrive of a few couchdb documents. nothing deadly in here.
{
"_id": "37812985fc6e7a3f285b9a17c6907249",
"_rev": "15-3274f0b73e1e2f81af9a1fe3adc652dc",
"username": "Josh",
"doc_type": "userDoc",
"hash": "365f62917a9cee010fead042b886b1a8a166bf045b4458b23e0a830a69b63f75134de79b8ba59d618a38f2e9de19e634d2431447c5997801ea83dc1ef2edeccf",
"permission": "god",
"ip": "::1",
"datetime": "2011-09-11 12:52:08",
"oauth": {
@JoshAshby
JoshAshby / gist:1204935
Created September 8, 2011 22:20
Couchdbkit
import couchdbkit
database = couchdbkit.Server()["stats"]
class productDoc(couchdbkit.Document):
barcode = couchdbkit.StringProperty()
productDoc.set_db(database)
@JoshAshby
JoshAshby / testPage.py
Created August 30, 2011 23:14
Sample style and structure for my API currently
#!/usr/bin/env python
debug = 1
"""
Project Blue Ring
An inventory control and management API
A test sub app for messing around with new things and what not before I decide to use them or not.
For more information, see: https://github.com/JoshAshby/House-Inventory-API