Skip to content

Instantly share code, notes, and snippets.

View erikvanzijst's full-sized avatar

Erik van Zijst erikvanzijst

View GitHub Profile
@erikvanzijst
erikvanzijst / image2bin.py
Created October 25, 2019 00:07
Scramble video game level compiler
#!/usr/bin/env python3
import argparse
import sys
from PIL import Image
if __name__ == '__main__':
parser = argparse.ArgumentParser(
sys.argv[0], description='Convert image to binary.')
parser.add_argument('file', type=argparse.FileType('rb'))
@erikvanzijst
erikvanzijst / cloneall.py
Last active July 1, 2020 18:56
Clone all Bitbucket Mercurial repos
#!/usr/bin/env python3
import argparse
import os
import subprocess
# install deps:
# $ pip install requests mercurial
import requests
# Create an OAuth Consumer with Account and Repository Read permission:
@erikvanzijst
erikvanzijst / parsexml.txt
Last active February 21, 2023 22:05
xmltodict
In [1]: import xmltodict
In [14]: print(data)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<server>
<response>
<status>ok</status>
<actions>
<action>
<subsystem>hourChooser</subsystem>
@erikvanzijst
erikvanzijst / mp.py
Last active March 13, 2023 08:21
Parallel web crawler
#!/usr/bin/env python3
# Simple multi-processing web crawler, following all a.href's that end in a '/'.
import os
import traceback
from itertools import chain
from multiprocessing import Pool
from time import time
from urllib.parse import urljoin
from bs4 import BeautifulSoup