How to configure your Mac to use DNS over TLS in five easy steps:
-
Install Stubby with Homebrew (https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Daemon+-+Stubby):
brew install stubby
-
Edit the configuration file:
How to configure your Mac to use DNS over TLS in five easy steps:
Install Stubby with Homebrew (https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Daemon+-+Stubby):
brew install stubby
Edit the configuration file:
from django.db.models.signals import post_init | |
def track_data(*fields): | |
""" | |
Tracks property changes on a model instance. | |
The changed list of properties is refreshed on model initialization | |
and save. | |
>>> @track_data('name') |
""" | |
I am sure everyone has something like this already. | |
I think PyDanny may have even built this into Django-Mongonaut. | |
But I needed to have this without installing any extra stuff. | |
Please enjoy version 0.0.3 of my class-based list/detail views for PyMongo. | |
""" | |
from bson.objectid import ObjectId | |
from common.mongo import MongoConnection | |
from django.conf import settings | |
from django.views.generic.base import View |
A collection of links for a NICAR 2012 presentation. It will suggest broad themes for the past year, and try to support them with examples from work in the field. This is a work in progress. Feel free to crap on it, or add your own ideas.
page = require('webpage').create() | |
page.onConsoleMessage = (msg) -> | |
console.log 'CONSOLE:' + msg | |
page.onResourceRequested = (params, request) -> | |
isJavaScript = params['url'].slice(-3) is '.js' | |
isJQuery = (params['url'].indexOf 'jquery') isnt -1 | |
if isJavaScript and not isJQuery |
from itertools import count | |
def chunked_iterator(iterable, chunk_size): | |
"""Given a slice-able yield individual items but consume them in chunk_size | |
batches so we can e.g. retrieve records from Solr in 50-100 batches | |
rather than the default 10 | |
Note that unlike the itertools grouper example we must use slice notation | |
to trigger things like Haystack's sliced __getitem__ to set our own batch | |
size |
// Source: http://www.census.gov/geo/www/ansi/countylookup.html | |
var countyToFIPS = { | |
'Alabama': { | |
'Autauga County': '01001', | |
'Baldwin County': '01003', | |
'Barbour County': '01005', | |
'Bibb County': '01007', | |
'Blount County': '01009', | |
'Bullock County': '01011', |
import math | |
from django.contrib.gis.geos import Point | |
class Cartogram(object): | |
""" | |
Takes a GeoDjango queryset and creates a cartogram of circles based on | |
the Dorling algorithm. | |
User must provide a queryset and strings pointing to the data attribute |
require 'rubygems' | |
require 'rest-client' | |
g = "http://go" | |
o = "o" | |
loop do | |
url = g + o + "gle.com" | |
p "trying " + url | |
p RestClient.get(url).headers |
// usage: var mytable = new Sorty(table); | |
(function(){ | |
var Row = function(el) { | |
this.values = $.map($(el).find('td'), function(e) { | |
var el = $(e); | |
var attr = el.attr('data-sort'); | |
return attr ? parseFloat(attr) : el.text(); | |
}); | |
this.el = $(el); |