Skip to content

Instantly share code, notes, and snippets.

@regebro
regebro / requirements.py
Last active August 29, 2015 14:02
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:
return
@regebro
regebro / editors.rst
Last active August 29, 2015 14:21
Dogmas on code editors and IDEs

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
regebro / sanetizing_plone_views.rst
Last active December 15, 2015 21:29
Overview over ways to create views in Zope, and some opinions on their future.

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.

@regebro
regebro / gedconvert.py
Created April 12, 2017 16:11
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 = infile.read(2**16)
if not text:
@regebro
regebro / ispstatus
Last active February 10, 2023 08:48
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.
#!/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': 'http://192.168.1.1',
}
import glob
import os
import pathlib
import subprocess
import sys
# Places we might find a Python install:
possible_python_paths = []
if os.name in ("nt", "os2"):