Skip to content

Instantly share code, notes, and snippets.

View wbolster's full-sized avatar
🎹
🦄

wouter bolsterlee wbolster

🎹
🦄
View GitHub Profile
@dustismo
dustismo / gist:6203329
Last active November 30, 2022 00:22
How to install leveldb on ubuntu
sudo apt-get install libsnappy-dev
wget https://leveldb.googlecode.com/files/leveldb-1.9.0.tar.gz
tar -xzf leveldb-1.9.0.tar.gz
cd leveldb-1.9.0
make
sudo mv libleveldb.* /usr/local/lib
cd include
sudo cp -R leveldb /usr/local/include
@wandernauta
wandernauta / sp
Last active May 14, 2024 16:49
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@lebedov
lebedov / Makefile
Last active October 3, 2016 21:03
How to expose the raw bytes in Python container classes to C functions using Cython.
funcs:
python setup.py build_ext --inplace
test: funcs
gcc -L. test.c -o test -lmyfuncs
clean:
rm -f test *.o *.so funcs.c
@nZac
nZac / sqlalchemy_debugger.py
Last active April 16, 2019 13:07
SQLAlchemy query to compiled SQL string
try:
import sqlparse.format as sqlformat
except ImportError:
def sqlformat(query, **kwargs):
"""Monkey patch sqlparse.format if package not installed"""
return query
def debug_query(query, engine):
"""Return a parametrized and formated sql query for debugging
@gonejack
gonejack / mapper-0.74.map
Last active February 26, 2024 11:19
Colemak keymap for DOSBox, put this file to %LOCALAPPDATA%\DOSBox
hand_shutdown "key 290 mod1"
hand_capmouse "key 291 mod1"
hand_fullscr "key 13 mod2"
hand_pause "key 19 mod2"
hand_mapper "key 282 mod1"
hand_speedlock "key 293 mod2"
hand_recwave "key 287 mod1"
hand_caprawmidi "key 289 mod1 mod2"
hand_scrshot "key 286 mod1"
hand_video "key 286 mod1 mod2"
@bradfa
bradfa / backups-with-bup.md
Last active September 3, 2021 13:54
Backups with bup

Exact Steps: Doing backups with bup to an external hard disk

Initial setup and first backup:

  1. Mount hard disk to /mnt/usb (you are strongly encouraged to use luks encryption on this disk!)
  2. mkdir /mnt/usb/.bup && bup init -r /mnt/usb/.bup to create and initialize a .bup directory on the USB disk. You may need to do some sudo and chmod/chgrp action depending on how your USB disk gets mounted. You'll save the actual files from backups here later.
  3. bup init to create the core bup repo in your home directory, the index will live here
  4. bup index ~/ to index your home directory
  5. bup index /etc to index your /etc directory
  6. bup save -n ${HOSTNAME}-etc -r /mnt/usb/.bup /etc to save the backup of your /etc directory to your USB disk. This backup set will result in a branch named after ${HOSTNAME}-etc, so that if you backup other PCs to this same .bup directory on your USB disk, you'll be able to see each one in a separate branch
@meeuw
meeuw / injectinput.py
Last active September 27, 2021 09:40
Simple script to replace xdotool when using Gnome/Wayland for entering keystrokes using evdev. This requires root.
# MOVED TO: https://github.com/meeuw/injectinput
#!/usr/bin/python3
import evdev
import sys
upper = { '!': '1', '@': '2', '#': '3', '$': '4', '%': '5', '^': '6', '&': '7', '*': '8', '(': '9', ')': '0' }
with evdev.UInput() as ui:
escape = False
@marshallpierce
marshallpierce / temporenc.md
Last active February 2, 2017 01:20
Temporenc alternate encoding

Date

temporenc v1:

100YYYYY YYYYYYYM MMMDDDDD

lifthrasiir v1:

YYYYYYYY YYYYMMMM DDDDD111

@judy2k
judy2k / know_thyself.py
Last active July 5, 2022 06:35
__qualname__ implementation in Python 2
from inspect import isclass
import __builtin__
# We're going to overwrite object, so we need to squirrel away the old one:
obj = object
# Metaclass, overriding the class' __getattribute__,
# so that __qualname__ can be generated and cached on access:
class QualnameMeta(type):
@yyscamper
yyscamper / jsonb_remove_keys.sql
Created February 26, 2018 09:49
PostgreSQL: Remove Multiple Keys From JSONB
CREATE OR REPLACE FUNCTION jsonb_remove_keys(
jdata JSONB,
keys TEXT[]
)
RETURNS JSONB AS $$
DECLARE
result JSONB;
len INT;
target TEXT;