Skip to content

Instantly share code, notes, and snippets.

Avatar

Edmund von der Burg evdb

  • Stockholm, Sweden.
View GitHub Profile
@evdb
evdb / NPR-fatty.rss
Last active Jun 20, 2017
Set dates correctly (I hope...)
View NPR-fatty.rss
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>Captain Fatty Lives the High Life on the High Seas</title>
<description>Weekend Edition Sunday follows Captain Fatty Goodlander as he sails through Southeast Asia and talks about his life at sea and his philosophy of freedom and discovery.</description>
<link>http://www.npr.org/templates/story/story.php?storyId=90411144</link>
<itunes:image href="https://media.npr.org/programs/wesun/features/2008/may/fatty540-47c249204d6b6e9d473df4cb080a6b88262e97e4.jpg" />
<pubDate>18 May 2008 00:01:00 EST</pubDate>
<language>en-us</language>
<copyright> 2017 NPR </copyright>
View sudoku-3-line-tidy.pl
use integer;
@A = split //, <>;
sub R {
for $i ( 0 .. 80 ) {
next if $A[$i];
my %t = map {
$_ / 9 == $i / 9
|| $_ % 9 == $i % 9
|| $_ / 27 == $i / 27 && $_ % 9 / 3 == $i % 9 / 3
View sudoku-3-line.pl
use integer;@A=split//,<>;sub R{for$i(0..80){next if$A[$i];my%t=map{$_/9
==$i/9||$_%9==$i%9||$_/27==$i/27&&$_%9/3==$i%9/3?$A[$_]:0=>1}0..80;R($A[
$i]=$_)for grep{!$t{$_}}1..9;return$A[$i]=0}die@A}R
View sudoku-4-line-shorter.pl
$a=8;$G{int(++$a/9).$a%9+1}=$_ for split//,<>;@A=1..9;sub c{int(($_[0]-1
)/3)*3}sub G{for$y(@A){for$x(@A){$t=$G{my$c=$y.$x}&&next;$t.=$G{$_.$x}.
$G{$y.$_}for@A;for$f(1..3){$t.=$G{c($y)+$f.c($x)+$_}for 1..3}G($G{$c}=$_
)for grep$t!~m/$_/,@A;return$G{$c}=0}}die map{$G{$_}||"\n"}9..100}G
View sudoku-4-line-tidy.pl
$a = 8;
$G{ int( ++$a / 9 ) . $a % 9 + 1 } = $_ for split //, <>;
@A = 1 .. 9;
sub c {
int( ( $_[0] - 1 ) / 3 ) * 3;
}
sub G {
for $y (@A) {
View sudoku-4-line.pl
$a=8;$G{int(++$a/9).$a%9+1}=$_ for split//,<>;@A=1..9;sub c{int(($_[0]-1
)/3)*3}sub G{for$y(@A){for$x(@A){$p=$t=$G{my$c=$y.$x}&&next;$t.=$G{$_.$x
}.$G{$y.$_}for@A;for$f(1..3){$t.=$G{c($y)+$f.c($x)+$_}for 1..3}G($G{$c}=
$_)&&return for grep$t!~m/$_/,@A;return$G{$c}=0}}die map{$G{$_}}9..99}G
View models.py
from django.db import models
from autoslug import AutoSlugField
from pombola.core.models import Person
# TODO
#
# - add a source for the data, possibly as a field on the Release?
# - resolve how to differentiate between items that are one-offs (like gift to person) and ongoing (like employment or land ownership). Concern is that one-offs may get lost if only the latest release is shown, or duplicated if they are included in several releases.
View gist:6918398
(pombola-virtualenv)mzalendo-staging@ajax:/data/vhost/za-pombola.staging.mysociety.org/pombola$ ./manage.py
...snip...
[za_hansard]
hansard_check_for_new_sources
hansard_load_into_sayit
hansard_run_parsing
pmg_scraper
questions
za_hansard_check_for_new_sources
za_hansard_load_into_sayit
View gist:6867195
evdb@custard-2 ~ $ virtualenv .venv
New python executable in .venv/bin/python
Installing setuptools............done.
Installing pip...............done.
evdb@custard-2 ~ $ source .venv/bin/activate
(.venv)evdb@custard-2 ~ $ pip install scraperwiki
You can’t perform that action at this time.