Skip to content

Instantly share code, notes, and snippets.

View stigtsp's full-sized avatar
💭
I may be slow to respond.

Stig stigtsp

💭
I may be slow to respond.
View GitHub Profile
# this works sometimes (dunno why)
esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash -fm dio -fs 32m -ff 40m 0x00000 esp8266-20180511-v1.9.4.bin
# possibly unsafe btw
curl https://www.musicforprogramming.net/rss.php | grep -oP '(?<=guid>)[^<]+' | sort -u | xargs -n 1 curl -O
# deletes issue 1..75
for i in (seq 1 75)
curl --request DELETE --header "PRIVATE-TOKEN: $GL_TOKEN" https://gitlab.com/api/v4/projects/$GL_PROJECT_ID/issues/$i
end
@stigtsp
stigtsp / creative-commons-music-for-confs
Last active August 22, 2018 14:37
Background music for conferences (CC)
https://soundcloud.com/maximkornyshev/watermelon-land-and-marmalade
https://soundcloud.com/geoplex/skydrive?in=user-983799952/sets/creative-commons
https://soundcloud.com/martinammeer/sets/8-bit-blipblop-chiptune
https://soundcloud.com/exilisss/01-exilis-paper-plane
https://soundcloud.com/psilodump/l-tsades-krama-album-version-1
https://soundcloud.com/kingdeluxesounds/set1-winter-12-gangpol-und-mit
https://soundcloud.com/enoughrec/chuzausen-random-breakfast
https://soundcloud.com/nicolai-helidlas/happy-electronic-background-music-i-adore-my-c64?in=aerickson-2/sets/creative-common
https://soundcloud.com/jimmysquare/this-is-my-tape-for-you?in=aerickson-2/sets/creative-common
https://soundcloud.com/engelwoodmusic/yes-you-can-use-this-in-your-vlog-feat-dyalla?in=aerickson-2/sets/creative-common
fping -qC3 $(grep Endpoint /etc/wireguard/*.conf | cut -d'=' -f2 | cut -d: -f1)
///
/// PROBABLY INSECURE. DONT DO THIS!
///
sh("curl https://github.com/USERNAME.gpg | gpg --import") // Github username
sh("gpg --tofu-policy good 0xKEYID") // Trusted keyid
sh("git verify-commit HEAD") // or "git pull --verify-signatures"
pyz:
rm -f build.pyz
rm -rf build
mkdir build
cp -R src/* build
find build -type f -name '*.pyc' -delete
find build -newermt '2018-01-01' -print0 | xargs -0r touch --no-dereference --date='2018-01-01'
python2.6 -m compileall build
find build -type f -name '*.py' -delete
# rm build/__main__.pyc
@stigtsp
stigtsp / wireguard.nix
Created November 20, 2018 14:46
wireguard setup for nixos 18.09 (works with mullvad, default route everything)
{ stdenv, pkgs, lib, ... }:
{
networking.wireguard.interfaces = {
wg0 = {
ips = [ "10.0.0.1/32" "fc00:bbbb:bbbb:bbbb::bbbb/128" ];
privateKeyFile = "/private/wireguard-pk";
table = "51820";
postSetup = ''
wg set wg0 fwmark 51820
ip -6 rule add not fwmark 51820 table 51820

how to run ovftool in nixos (quick n dirty way)

  1. install VMware-ovftool*.sh on debian or something like that
  2. copy /usr/lib/vmware-ovftool from the container/machine to ~/warez/vmware-ovftool on nixos
  3. use patchhelf to patch the binary: patchelf --set-interpreter /nix/store/7gx4kiv5m0i7d7qkixq2cwzbr10lvxwc-glibc-2.27/lib/ld-linux-x86-64.so.2 ~/warez/vmware-ovftool/ovftool.bin
  4. change #!/bin/bash to #!/bin/sh in ~/warez/vmware-ovftool/ovftool
  5. create an absolute symlink from ~/bin/ovftool to ~/warez/vmware-ovftool/ovftool
#! /usr/bin/env nix-shell
#! nix-shell <nixpkgs> -i python3 -p "python3.withPackages(x: with x; [ flask python-gnupg ])"
import flask
import gnupg
print("Hello! I'm python!")