Skip to content

Instantly share code, notes, and snippets.

@drsm79
drsm79 / import_csv.py
Created September 10, 2012 11:55
d3 with CouchDB using views
import csv
import requests
import json
import time
reader = csv.DictReader(open('_attachments/sp500.csv', 'rb'))
database = "http://127.0.0.1:5984/d3apps4"
to_upload = {"docs": []}
@drsm79
drsm79 / README
Last active October 11, 2015 14:18
silly little script to test that a haiku matches the syllable pattern. Call test with your haiku, split() on new lines.
@drsm79
drsm79 / map.js
Last active December 12, 2015 09:48
CouchDB attachments by content type
function(doc) {
if (doc._attachments){
for (a in doc._attachments){
emit(doc._attachments[a].content_type, 1);
}
}
}
/* dashboard-specific css goes here */
#index {
#summary {
span.cost {
display: block;
font-size: 200%;
font-weight: bold;
padding: @buffer 0 @buffer 0;
span.super {
vertical-align: super;
@drsm79
drsm79 / d3-hello.html
Last active September 6, 2016 10:01
d3
<html>
<head>
<script type="text/javascript" src="d3.v3.js" charset="UTF-8"></script>
</head>
<body>
<div id="d3workspace"></div>
<script type="text/javascript">
// Pick the #d3workspace element
d3.select('#d3workspace')
// We're going to work with a p element
@drsm79
drsm79 / ConfigAction.py
Created June 24, 2013 20:01
I wanted a way to get my argparser to read args from a config file, so came up with this.
from argparse import Action, FileType, _ensure_value
class ConfigAction(Action):
"""
Given a json file ConfigAction will populate the parser with properties
defined in the json. This won't override settings from other actions or
allow settings not defined in the parser initialisation.
"""
{
"pid": "1234",
"name": "TShirt",
"price": 20
"colors": ["blue","red","white"],
"sizes": ["S","M","L","XL","XXL","XXXL"],
"type": "product-cached"
"modifications": {
"colors": ["blue", "red", "white", "black"],
"sizes": ["S","M","L","XL"],
@drsm79
drsm79 / fibber.py
Last active May 14, 2018 22:30
Fibonacci to chord sequence
def fib_next(current, previous):
return current + previous, current, int(oct(current + previous).strip('L')[-1])
scale = ['F', 'g', 'a', 'Bb', 'C', 'd', 'em7b5', 'F']
def runme(iterations=False):
pattern = [0, 1]
previous, current = pattern
n = 0
@drsm79
drsm79 / WSL Mutable Dev.md
Created June 5, 2018 22:07
Setting up WSL for building Mutable Instrument firmware

Bit of trial and error has resulted in:

  • sudo apt install gcc-avr avr-libc
  • pull in the code & submodules: git clone https://github.com/pichenettes/eurorack.git && git submodule init && git submodule update
  • edit avrlib/makefile.mk to point AVRLIB_TOOL_PATH to /usr/bin and set PROGRAMMER to usbtiny
  • make -f branches/makefile

Seems to build...

The proposal for using Sims Hill as a site for a new park and ride seems a poor choice.

The land itself is fertile & used to grow food for residents of Bristol. It has high quality, productive soil. The selection of this site seems contrary to both Bristol council strategic policy (p.73, Bristol Development Framework Core Strategy) and WECA guidance (which is to minimise loss of productive land when building housing - why would this not be applied to transport?).

Secondly, the location itself is poor for a park and ride. Traffic backs up on the M4 entering the M32. This would imply a site accessible directly from the M4 is necessary to actually reduce congestion. A site near Emersons Green or the Bristol & Bath cience park seems more suitable, especially given the light industrial use in the area (e.g. distribution warehouse off Jenner Boulevard, Puma energy off Folly Brook). This would enable the park and ride to connect directly to the M4 reducing congestion on both M4 and M32 and connect into the metrobu