Skip to content

Instantly share code, notes, and snippets.

View marklit's full-sized avatar

Mark Litwintschik marklit

View GitHub Profile
@marklit
marklit / generate.sh
Created November 11, 2014 22:13
Generate messages with serial ids
# From: http://www.reddit.com/r/Python/comments/2lzry9/most_efficient_way_to_generate_random_dataevents/clzoj3t
head -c <large number> /dev/zero ¦ tr '\0' '\n' ¦ cat -n ¦ xargs -L1 printf 'This is message number %s\n'
@marklit
marklit / english.py
Last active August 29, 2015 14:10
Generate English Sentences
from itertools import chain, product
from re import match, findall
GRAMMAR = '''
<sentence> ::= <noun phrase=""> <verb phrase="">
<noun> ::= "boy " | "troll " | "moon " | "telescope "
<transitive verb=""> ::= "hits " | "sees "
<intransitive verb=""> ::= "runs " | "sleeps "
<adjective> ::= "big " | "red "
@marklit
marklit / check.py
Created January 23, 2015 16:46
Postcode exceptions
from postcode import uk as uk_postcode
"""
452012,S119FJ,53.357507510309200,-1.505868797298880
452013,S119FL,53.357735137233300,-1.506572342021560
452014,S119FN,53.356698394080900,-1.503669525537920
"""
for line in open('postcodes.csv'):
pieces = line.strip().split(',')
@marklit
marklit / stop-logstash.md
Created March 3, 2015 11:17
Stop logstash
$ echo manual | sudo tee /etc/init/logstash-web.override
$ sudo stop logstash-web
$ sudo stop logstash
@marklit
marklit / moved to proper repo.rst
Last active August 29, 2015 14:17 — forked from rezsa/recommender_spark.py
Film recommendations with Apache Spark and Python
from random import randint
LIVING_SPACE_CELL_SIZE = 24
class Alive(object):
pass
@marklit
marklit / _install.sh
Last active August 29, 2015 14:24
EC2 spot prices in tabular form across all regions
pip install requests termcolor tabulate
@marklit
marklit / passengers.json
Last active August 29, 2015 14:27
Commercial Airline passengers per year
{
"ACE-BFS": {
"airports": {
"ACE": {
"airport_name": "Lanzarote Airport",
"iata": "ACE",
"latitude": 28.94556,
"longitude": -13.60528
},
"BFS": {
@marklit
marklit / passengers.svg
Last active August 29, 2015 14:27
Commercial Airline Passenger Counts between airports (for latest year reported, usually 2013)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marklit
marklit / passenger_counts.csv
Last active August 29, 2015 14:27
Commercial Airline Passenger Counts between airports (for latest year reported, usually 2013)
ABE CLT 49130
ABE DTW 31350
ABE MYR 7670
ABE PHL 34670
ABE PIE 24270
ABX SYD 225400
ABZ BHX 125060
ABZ DUB 47295
ABZ KOI 49091
ABZ LCY 63163