Skip to content

Instantly share code, notes, and snippets.

View lukasjuhrich's full-sized avatar
💭
FJAFJKLDSKF7JKFDJ

Lukas Juhrich lukasjuhrich

💭
FJAFJKLDSKF7JKFDJ
  • AG DSN
  • Dresden
View GitHub Profile
@lukasjuhrich
lukasjuhrich / Summary.md
Created May 25, 2022 15:46
Some md please ignore

⚠️ 1 Outdated NPM packages

package current wanted latest dependent
d3 3.5.17 3.5.17 7.4.4 pycroft
@lukasjuhrich
lukasjuhrich / migrate.py
Last active June 2, 2020 04:59
SDK-Style migration of `.csproj` files
import fileinput as fi
import logging
import re
import sys
import typing
logging.basicConfig(
#filename='migrator.log',
level=logging.INFO,

Implement domains

CREATE DOMAIN public.ip_port AS integer
	CONSTRAINT ip_port_check CHECK (((VALUE >= 1) AND (VALUE <= 65535)));
CREATE DOMAIN public.ip_protocol AS smallint
	CONSTRAINT ip_protocol_check CHECK (((VALUE >= 0) AND (VALUE <= 255)));

Perhaps follow the JSON implementation

def get_next_field(buf):
"""Parse the buffer to return the next field
Each field is of the format `<field length>\x00<field>`
"""
if buf[:2] == b'\0\0':
# Field of length zero
return b'', buf[2:]
raw_length, rest = buf.split(b'\0', maxsplit=1)
length = int.from_bytes(raw_length, byteorder='little')
@lukasjuhrich
lukasjuhrich / col_refactoring.py
Last active October 7, 2016 15:24
Some thoughts on column refactoring in pycroft (#52)
# pylint: disable=all
# Original idea:
@bp.route("/<int:user_id>/hosts")
def user_show_hosts_json(user_id):
list_items = []
for user_host in User.q.get(user_id).user_hosts:
# …