Skip to content

Instantly share code, notes, and snippets.

# /etc/udev/rules.d/20-bt-auto-enable-a2dp.rules
# hxss
SUBSYSTEM=="bluetooth", ACTION=="add", RUN+="/home/hxss/.config/scripts/xorg/bt-auto-enable-a2dp.sh"
@sveitser
sveitser / filter.py
Last active April 9, 2019 13:41
pydub de-esser / bandstop filter
# pip install pydub scipy
import pydub.scipy_effects
from pydub import AudioSegment
from pydub.playback import play
raw = AudioSegment.from_wav("blah.wav")
six = pydub.scipy_effects.low_pass_filter(raw, 6000, order=1)
play(raw)
play(six)
#!/usr/bin/env bash
#
# Usage
#
# python2nix my_pypi_package > my_package.nix
#
# TODO
# - accept 'format' as arg
# - prepopulate dependencies?
set -euo pipefail
$ nix-shell -p python3Packages.joblib 2.781s 15:53:29
these derivations will be built:
/nix/store/w6q794hqy3q4fi9arc8cx09hwhaixng7-python3.7-joblib-0.12.4.drv
building '/nix/store/w6q794hqy3q4fi9arc8cx09hwhaixng7-python3.7-joblib-0.12.4.drv'...
unpacking sources
unpacking source archive /nix/store/ch8lr3bkfqnhnrwbcbibj00pmbrgzgg2-source
source root is source
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file source/setup.py
patching sources
configuring

Setup weechat relay, accessible via ssh-tunnel.

  1. Add tmux and weechat to environment.systemPackages.
  2. ssh into on server
  3. run weechat inside tmux
  4. Make sure port 8001 is blocked by firewall.
  5. inside weechat:
/relay add weechat 8001
@sveitser
sveitser / config.c
Last active January 8, 2019 14:50
Vortex pok3r with home row modifiers.
/*
* Copyright (c) 2018 Charlie Waters
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
#!/usr/bin/env bash
#
# Usage
#
# python2nix my_pypi_package > my_package.nix
#
# TODO
# - accept 'format' as arg
# - prepopulate dependencies?
set -euo pipefail
@sveitser
sveitser / bench.py
Created October 24, 2018 03:13
Untested, probably doesn't work.
#!/usr/bin/env python
#
# DANGEROUS!
#
# Benchmark drive with bonnie using ext4: vanilla, LUKS, LVM, LUKS + LVM
import os
import time
import sys
from sh import (
@sveitser
sveitser / bonnie-ssd-benchmark.sh
Created October 21, 2018 15:12
Bonnie, ext4, lvm, luks benchmark.
#!/bin/bash
#
# DANGEROUS!
#
# Benchmark drive with bonnie using ext4: vanilla, LUKS, LVM, LUKS + LVM
#
set -euxo pipefail
DISK="/dev/sda"
RUNS=3
# luks + lvm + ext4
Version 1.97 ------Sequential Output------ --Sequential Input- --Random-
Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
lulus 63G 892 99 40625 2 222666 13 2307 99 530668 15 +++++ +++
Latency 9188us 55434ms 33401ms 3675us 16365us 390us
Version 1.97 ------Sequential Create------ --------Random Create--------
lulus -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP