Skip to content

Instantly share code, notes, and snippets.

@meeuw
meeuw / lowvol.sh
Created September 28, 2019 19:27
lower wav files volume to 1% using sox
for W in *.wav ; do sox -v .01 $W lowvol/$W ; done
REM *** Pythagoras tree ****
SCREEN 12: REM screen 12 voor VGA
CLS : pi = 4 * ATN(1)
WINDOW (-2.5, 2)-(5.5, 5)
INPUT "tolerantie (kan .1 zijn) =", eps: CLS
p = 32: DIM xa(p), ya(p), xb(p), yb(p), s(p)
REM *** initialiseren ****
h = pi / 3'prescribed angle
a1 = COS(h) * COS(h): b1 = SIN(h) * COS(h)
a2 = SIN(h) * SIN(h): b2 = -b1
@meeuw
meeuw / build-grub2.sh
Created May 23, 2019 19:10
Script to create an image for a minimal grub2 efi usb stick for booting Fedora (using blscfg) on a macbook.
#!/bin/bash
function fish() {
echo "#" "$@"
guestfish --remote -- "$@" || exit 1
}
eval $(guestfish --listen)
img=grub2-usb.raw
@meeuw
meeuw / reassoc.py
Last active September 13, 2019 07:01
script to disconnect current wifi connection
#!/usr/bin/env python3
# https://w1.fi/wpa_supplicant/devel/dbus.html
import dbus
import sys
if len(sys.argv) > 1:
interface = sys.argv[1]
else:
interface = 'wlp0s20f0u2u2'
@meeuw
meeuw / apachetop.py
Created January 30, 2019 08:38
combine cpu load with output from mod_status to create a apache like top
#!/usr/bin/env python
import psutil
import time
import requests
import lxml.html
print('\033c')
while 1:
@meeuw
meeuw / juicessh.py
Last active January 25, 2019 20:14
script to load/unlock using juicessh gestures
#!/usr/bin/env python3
import dbus
import tty
import termios
import sys
def getchar():
#Returns a single character from standard input
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
@meeuw
meeuw / pttest.py
Last active October 13, 2018 14:30
reproduce prompt toolkit assert using pexpect and click
#!/usr/bin/env python
import sys
if 'prompt' in sys.argv:
from prompt_toolkit.shortcuts import PromptSession, CompleteStyle
import click
prompt_app = PromptSession(message='>')
query = ''
while 1:
try:
@meeuw
meeuw / install.sh
Created September 4, 2018 18:41
use mpv for streaming dvb-t in Fedora
dnf install dtv-scan-tables v4l-utils
dvbv5-scan -o ~/.config/mpv/channels.conf -O vdr /usr/share/dvbv5/dvb-t/nl-All
mpv dvb://NPO\ Radio\ 1
@meeuw
meeuw / rsapem2json.py
Last active December 13, 2020 15:13
Will convert the RSA PEM private key to the Letsencrypt/Certbot private_key.json file. From: https://www.osso.nl/blog/convert-dehydrated-certbot-letsencrypt-config/
#!/usr/bin/env python
# Usage: openssl rsa -in account_key.pem -text -noout | python rsapem2json.py
# Will convert the RSA PEM private key to the Letsencrypt/Certbot
# private_key.json file.
#
# Public Domain, Walter Doekes, OSSO B.V., 2016
#
# From:
# -----BEGIN RSA PRIVATE KEY-----
# MIIJJwsdAyjCseEAtNsljpkjhk9143w//jVdsfWsdf9sffLgdsf+sefdfsgE54km

New sqlcomplete library

Design Principles

  • Easily extendable for different SQL dialects (PostgreSQL/MySQL/MS-SQL/SQLLite)
  • Completion should always work, also with invalid/incomplete SQL
  • Use sqlparse and prompt_toolkit as much as possible, don't try to abstract either
  • Prioritize suggestions, the top suggestions always should complete to valid SQL. Tab-tab-tab-tab should complete to something like select * from firsttable