Skip to content

Instantly share code, notes, and snippets.


Lennart Regebro regebro

View GitHub Profile
import glob
import os
import pathlib
import subprocess
import sys
# Places we might find a Python install:
possible_python_paths = []
if in ("nt", "os2"):
regebro /
Created Apr 12, 2017
A file to fix spurios encoding errors in a gedcom.
import smc.bibencodings
import sys
infile = open(sys.argv[1], 'rb')
outfile = open(sys.argv[2], 'wb')
while True:
text =**16)
if not text:
regebro / editors.rst
Last active Aug 29, 2015
Dogmas on code editors and IDEs
View editors.rst

Dogmas on code editors and IDEs

In the editor wars between Emacs and Vim I have always disliked both strongly. Although the first real editor I used was Emacs, and I usually use Vim when in a terminal, I despise both as outdated, hard to use relics of the 1970's. They require an enormous effort to learn to use, and they work completely differently from any modern user interface.

This document explains my dogmas about how an editor should work.

regebro / ispstatus
Last active Jan 28, 2019
A script that checks that the wifi is working, that the LAN is working and if the internet is working. Good for logging ISP problems.
View ispstatus
#!/usr/bin/env python3
from datetime import datetime
from urllib import request, error
from subprocess import check_output, CalledProcessError
from io import StringIO
from time import tzname, localtime
import socket
LOCAL_NET_URLS = {'r': '',
regebro /
Last active Aug 29, 2015
Prints the requirements of the current working set of packages. Requires setuptools.
# -*- coding:utf-8 -*-
import pkg_resources
projects = set()
def print_requirements(distribution, lvl=-1):
lvl += 1
dname = distribution.project_name.lower()
if dname in projects:
regebro / sanetizing_plone_views.rst
Last active Dec 15, 2015
Overview over ways to create views in Zope, and some opinions on their future.
View sanetizing_plone_views.rst

Sanetizing Plone Views

(Pun intended)

There are too many ways of createing views in Plone. This needs fixing. It's a job that is too much for any one person, so we need a plan. This is an attempt to look at the situation and asses things so that we can make a plan, which can then be made into a PLIP and worked on.