Skip to content

Instantly share code, notes, and snippets.

View andrelaszlo's full-sized avatar
🤓

André Laszlo andrelaszlo

🤓
View GitHub Profile
@andrelaszlo
andrelaszlo / fix_repos.sh
Last active May 18, 2017 17:27
Hack to fix a broken url using the GitHub API
#!/usr/bin/env bash
source token.sh # should export the ACCESS_TOKEN and USER variables
PAGE=1 # Run once per page (manually for now)
PER_PAGE=100 # Max 100
function list_repos {
echo "Listing repos" > /dev/stderr
curl -s -H "Authorization: token $ACCESS_TOKEN" "https://api.github.com/search/code?page=$PAGE&per_page=$PER_PAGE&q=http://www.eecs.harvard.edu/~kirsch/pubs/bbbf/esa06.pdf" | \
@andrelaszlo
andrelaszlo / password.py
Created June 14, 2012 10:57
Generate a truly random password, based on atmospheric noise (random.org!)
#!/usr/bin/python
###############################################################################
#
# Script for generating a truly random password, using atmospheric noise. The
# generator uses the web service at random.org
#
# Usage:
# password.py [password length] [alphabet]
# For example: password.py 5 abcdefgh
@andrelaszlo
andrelaszlo / personnummer.js
Created June 26, 2012 13:54
Function that checks if a swedish personnummer is valid
/*
* Function that checks if a swedish personnummer is valid.
* Author: André Laszlo <andre@laszlo.nu>
*/
function check_personnummer(pnr) {
// Do formatting and sanity control
pnr = pnr.replace(/[^0-9]/g, ''); // only keep digits
if (12 == pnr.length) // year format 1985 → 85
pnr = pnr.substr(2);