Skip to content

Instantly share code, notes, and snippets.

View ftrain's full-sized avatar

Paul Ford ftrain

View GitHub Profile
#!/bin/bash
#
# A script that takes a Twitter data archive, which is produced as a
# set of JavaScript files (different from the regular archive, which
# is CSV and HTML), and converts the `tweet.js` file, which contains
# all of the tweets, into tractable JSON, one tweet per line. It then
# inserts /that/ into a SQLite3 database, and extracts a simple
# relational table of tweets from the JSON. Finally, it runs datasette
# on the resulting database to allow you to explore.
@ftrain
ftrain / keybase.md
Created November 13, 2019 17:00
Keybase proof of identity

Keybase proof

I hereby claim:

  • I am ftrain on github.
  • I am ftrain (https://keybase.io/ftrain) on keybase.
  • I have a public key ASDM7VU2lSOHT1XBQ4IdkIv3O21V6lTe7fQLLbnG1Bop3Qo

To claim this, I am signing this object:

@ftrain
ftrain / spellingbee.py
Last active September 17, 2020 04:23
Spelling Bee solver
import argparse
from math import ceil
from more_itertools import powerset
from ordered_set import OrderedSet
"""
$ pip install more_itertools ordered_set
$ python spellingbee.py RACFKOT -h
usage: spellingbee.py [-h] [--words WORDS] CHARACTERS
@ftrain
ftrain / n3tosql.pl
Last active April 30, 2021 16:54
Convert n3 triples to SQL in SQLite3, your own Very Shitty Triplestore.
#!/usr/bin/perl
while (<>) {
s/'/''/g;
/^([^\s]+)\s*([^\s]+)\s*(.+)\s+\.\s*$/;
my $s = $1;
my $p = $2;
my $o = $3;
$s=~s/[<>]//g;
$p=~s/[<>]//g;