Skip to content

Instantly share code, notes, and snippets.

@ubipo
ubipo / transforming_tabular_data_code_example.py
Last active June 22, 2023 07:45
Code example for the "Transforming Tabular Data in Python" blog post
"""Add a column to a table indicating whether a bird is of
the Anatidae family (ducks, geese, and swans)."""
# Pandas (with PyArrow)
import pandas as pd
df = pd.read_csv(
"bird_spot.csv",
engine="PyArrow",
dtype_backend="PyArrow"
@ubipo
ubipo / download-cats.py
Last active March 1, 2023 20:33
You wouldn't download a cat
"""Download all cats aged 0-3 yrs from adopteereendier.be
Scraping is illegal in Belgium, so don't use this script. Also don't look at it
for too long, that's also illegal."""
from time import sleep
from urllib.request import urlopen
from lxml import etree
from lxml.cssselect import CSSSelector
import csv
import traceback
@ubipo
ubipo / clean-messenger-ext-link.js
Created February 28, 2022 11:33
Clean Facebook Messenger external link warning redirect
@ubipo
ubipo / linux-keychron-k3-key-remapping.md
Last active January 3, 2022 11:37
Keychron K3 Key Remapping Using udev hwdb

Keychron K3 Key Remapping Using udev hwdb

The Keychron K3 keyboard has two general modes: Mac/IOS and Win/Android. In the Win/Android mode, the F1-12 keys do not work for me (neither by pressing fn, nor after using the fn+X+L toggle). The F keys do work in the Mac/IOS mode (using fn).

The disadvantage of the Mac/IOS mode is that the alt and meta keys are swapped (both left & right). To work around this I remapped them using udev's hwdb.

To get the keycode of the key you want to remap, use evtest. showkey and evtest show different scancodes.

@ubipo
ubipo / webpack.prod.js
Created May 2, 2021 12:24
Webpack Vue sfc ssr
const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
output: {
publicPath: '/'
},
@ubipo
ubipo / rfm69-replay.ino
Created December 26, 2020 22:29
rfm69-replay.ino
#include <SPI.h>
#include <RH_RF69.h>
/************ Radio Setup ***************/
#define RF69_FREQ 433.95
#define RFM69_CS 4
#define RFM69_INT 15
#define RFM69_RST 16
#define LED 5
@ubipo
ubipo / xyztile2png.py
Created July 2, 2020 09:45
Stitch webtiles together with PIL, see also https://opentopomap.org/about#faq
from urllib.request import urlopen
from PIL import Image
x1=16886
x2=16897
y1=11082
y2=11092
z=15
tileDim=256
// ==UserScript==
// @name Edublend subnet solver
// @version 1
// @grant none
// @match https://edublend.ucll.be/MBI24A/Exercise/Question/*
// ==/UserScript==
var eStatus; // Status box lower right
const exNames = ["Subnet adressen", "Aantal hosts", "Subnetting", "Subnet masks"]
@ubipo
ubipo / tlt.prj.xml
Created June 16, 2018 14:35
tlt - TwiLightTimes; A tasker project that parses results from api.sunrise-sunset.org
<TaskerData sr="" dvi="1" tv="5.1.11b.bf4">
<dmetric>1080.0,1920.0</dmetric>
<Profile sr="prof73" ve="2">
<cdate>1528363217603</cdate>
<edate>1529159291109</edate>
<id>73</id>
<mid0>68</mid0>
<nme>tlt.autoUpdate</nme>
<Time sr="con0">
<fh>10</fh>