Skip to content

Instantly share code, notes, and snippets.

View hay's full-sized avatar

Hay Kranen hay

View GitHub Profile
#!/usr/bin/env python3
from bs4 import BeautifulSoup
from dataknead import Knead
from pathlib import Path
import requests
import sys
import urllib.request
API_KEY = "your-api-key-here"
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
title
"Rooms Katholieke Kerk"
"Gereformeerde Kerken in Nederland"
"Ned. Hervormde Kerk"
"PKN Gereformeerde Kerk"
"Islamitisch"
"Christelijke Gereformeerde Kerk"
"Evangelie Gemeente"
"Rooms-Katholieke Kerk"
"PKN Ned. Hervormd"
@hay
hay / resit-2b
Created November 14, 2018 15:16
Sean,706883
Adam,90500
Grace,407103
Sean,836266
Kelly,28335
@hay
hay / resit-2a
Created November 14, 2018 15:16
Welcome to the fake people database!
No people database yet
Make a choice:
1) Remove a person
2) Add a person
3) Quit the program
Make your choice: [1/2/3]: 2
Added Jane with phone number 52334
Saved the database with 1 people
There are 1 people in the database:
@hay
hay / resit-1
Created November 14, 2018 15:14
Hey, welcome to Number Guessr
Please state your name Hay
Welcome Hay! You'll have 5 tries to guess a number
The number will be between 1 and 100
You have 5 guesses remaining
What's your guess? 50
50 is not correct, the number is lower
You have 4 guesses remaining
What's your guess? 25
@hay
hay / fix-sql.py
Created November 11, 2018 21:03
A pretty horrible Python script to fix the SQL errors in the Rijksmonumenten dump mentioned here: https://github.com/clytras/AccessConverter/issues/5
#!/usr/bin/env python3
from tqdm import tqdm
from sys import argv, exit
from os.path import getsize
def fix_token(token):
if token == ",":
return "'',"
elif token == "(,":
return "('',"
# Converts a JSONL file generated with telegram-history-dump (1) to CSV
# Usage: python telegram-csv.py <path to json file> <path to output csv file>
# Example: python telegram-csv.py Bob.json Bob.csv
# 1: https://github.com/tvdstaaij/telegram-history-dump
from datetime import datetime
import unicodecsv as csv
import json, sys
def get_isodate(msg):
date = msg.get("date", None)
@hay
hay / WMStats.java
Last active August 30, 2016 11:03
Wikipedia statistics parser comparison
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class WMStats {
private static final String FILE_NAME = "pagecounts-20141029-230000";
@hay
hay / cheatsheet.md
Last active January 6, 2021 15:19
Hay's dev cheatsheet
@hay
hay / ex4.js
Last active December 11, 2015 01:29
var Module = Stapes.subclass({
sayName : function() {
console.log('i say my name!');
}
});
var BetterModule = Module.subclass({
// Note that this method name is the same as the one in Module
sayName : function() {
BetterModule.parent.sayName.apply(this, arguments);