Skip to content

Instantly share code, notes, and snippets.

View kcleong's full-sized avatar

Kim Chee Leong kcleong

  • Python United, Turftorr
  • The Netherlands, Groningen
View GitHub Profile
@kcleong
kcleong / backup_all_db.sh
Created December 3, 2024 13:52
Postgres backups
#!/bin/bash
while getopts c:p: flag
do
case "${flag}" in
p) port=${OPTARG};;
c) cluster=${OPTARG};;
esac
done
@kcleong
kcleong / kpn-ipv4-ipv6-tvbox.rsc
Last active June 7, 2025 19:08
KPN fiber Mikrotik config (working set-up for IPv4, IPv6, and KPN TV+ box)
# 2024-12-06 21:55:28 by RouterOS 7.16
# software id = BNE6-LLMM
#
# model = RB5009UPr+S+
# serial number = HF50964FXXX
/interface bridge
add arp=proxy-arp igmp-snooping=yes multicast-querier=yes name=local
set [ find default-name=sfp-sfpplus1 ] mtu=1512
/interface vlan
add comment=TV interface=sfp-sfpplus1 name=vlan1.4 vlan-id=4
@kcleong
kcleong / rb5009_kpn.rsc
Last active July 17, 2024 07:34
KPN fiber config with working IPv4 + IPTV, IPv6 not working
# 2024-07-10 09:06:10 by RouterOS 7.15.2
# software id = BNE6-LLMM
#
# See https://gist.github.com/kcleong/426ae7a5c3c5ecb4870bb82966e80ef4 for a working config
#
# model = RB5009UPr+S+
# serial number = HF50964FXXX
/interface bridge
add arp=proxy-arp igmp-snooping=yes name=local
/interface vlan
@kcleong
kcleong / Dockerfile
Last active June 3, 2024 14:30
Elasticsearch 6
# https://stackoverflow.com/questions/72717414/how-to-run-elasticsearch-v6-on-m1-arm-inside-docker
# docker build -t es6 .
# docker run -p 9200:9200 es6
FROM ubuntu:bionic-20220531
# Must be root to install the packages
USER root
from ZODB.utils import p64
# Replace with OIDs from: https://gist.github.com/kcleong/b12a5aaaf3df5df0fee737457eeda5a0
oids= []
for oid in oids:
oid = p64(oid)
try:
pickle, state = app._p_jar.db()._storage.load(oid)
except:
#!/usr/bin/env python
"""
Modified ZODB-5.8.0-py3.8.egg/ZODB/scripts/fsrefs.py to report broken OIDs.
This fixed this following error when running `./bin/zeopack.
Traceback (most recent call last):
File "./bin/zeopack", line 48, in <module>
sys.exit(plone.recipe.zeoserver.pack.main(host, port, unix, days, username, password, realm, blob_dir, storage))
File "/opt/APPS/cms/prd/plone.buildout/eggs/plone.recipe.zeoserver-2.0.3-py3.8.egg/plone/recipe/zeoserver/pack.py", line 65, in main
➜ example-web-component git:(main) ✗ npm install -S [email protected]
changed 1 package, and audited 28 packages in 880ms
3 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
➜ example-web-component git:(main) npx vite
Port 5173 is in use, trying another one...
➜ example-web-component git:(main) npm install -S [email protected]
changed 1 package, and audited 28 packages in 1s
3 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
➜ example-web-component git:(main) ✗ npx vite
Port 5173 is in use, trying another one...
@kcleong
kcleong / ikea.py
Created November 11, 2022 14:40
Example script to get ikea article numbers from a kitchen plan
"""
Example output:
41x: 60205664 | METOD | grijs | 200 cm | Kitchen cabinets
38x: 80338413 | BAGGANÄS | zwart | 143 mm | Knobs and handles
24x: 40205599 | METOD | zwart | 8 cm | Kitchen cabinets
19x: 70338418 | BAGGANÄS | grijs | 143 mm | Knobs and handles
18x: 40327505 | FÖRBÄTTRA | wit | 220x8 cm | Kitchen fronts
8x: 00455161 | ÄLMAREN | Kitchen taps, sinks and sink accessories
6x: 20317852 | LILLVIKEN | grijs | Kitchen taps, sinks and sink accessories
@kcleong
kcleong / django-dramatiq.log
Created November 8, 2022 09:21
Django dramatiq 0.11.0 stacktrace
./manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/Users/leong/.pyenv/versions/3.10.4/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
self.run()
File "/Users/leong/.pyenv/versions/3.10.4/lib/python3.10/threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "/Users/leong/.pyenv/versions/3.10.4/envs/xyz__3.10.4/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)