Skip to content

Instantly share code, notes, and snippets.

@dracos
dracos / change.py
Last active May 4, 2021
Update Twitter profile pic
View change.py
import os, sys
import tweepy
# config.py contains all the all-caps variables used below
from config import *
localfile = os.path.join(LOCALDIR, 'count')
try:
fp = open(localfile)
View east-lothian-with-buffer.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View split_postcode_lad.csv
We can't make this file beautiful and searchable because it's too large.
Postcode,LAD GSS code
AB10 7QB,S12000033
AB10 7QB,S12000034
AB12 3GQ,S12000033
AB12 3GQ,S12000034
AB12 3GW,S12000033
AB12 3GW,S12000034
AB12 3LN,S12000033
AB12 3LN,S12000034
AB12 3LP,S12000033
View gist:e48d6feb25d3f7a8d706a2945fbf1930
// ==UserScript==
// @name Collapse project columns
// @namespace mysociety.github.projects.collapse
// @description Collapse project columns (based on https://gist.github.com/yuyuvn/268c754325e945ceda24e4ce661a27ce)
// @include https://github.com/*/*/projects/*
// @version 1.0
// @grant none
// ==/UserScript==
document.querySelectorAll(".js-details-container").forEach(function(node){
View new-councils-april-2019.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View new-wards-april-2019-only.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View planit.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dracos
dracos / venv-setup.sh
Created Mar 10, 2016
Installing python2 & python3 and virtualenv (Ubuntu 14.04)
View venv-setup.sh
# Python 2
sudo apt-get install python-pip
pip install --user virtualenv
python ~/.local/bin/virtualenv venv2
# Python 3, option 1
sudo apt-get install python3-pip
pip3 install --user virtualenv
python3 ~/.local/bin/virtualenv venv3
# Python 3, option 2
sudo apt-get install python3.4-venv
@dracos
dracos / google-analytics.html
Last active Apr 12, 2018 — forked from fawkesley/google-analytics.html
Google Analytics that respects Do-Not-Track header
View google-analytics.html
<script>
var dnt = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
if (dnt != "1" && dnt != "yes") {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('send', 'pageview');
@dracos
dracos / gist:6307176
Last active Sep 1, 2017
Stopping the daemon fixmystreet app, and starting it in debug mode, printing everything to console
View gist:6307176
$ sudo /etc/init.d/fixmystreet stop
$ sudo /etc/init.d/nginx stop
$ sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
$ sudo su - fms
$ cd /var/www/fixmystreet/fixmystreet
$ script/server