Skip to content

Instantly share code, notes, and snippets.

@sigmonsays
sigmonsays / doom.txt
Created March 18, 2021 17:05 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@sigmonsays
sigmonsays / update-images.py
Created August 29, 2014 20:31
Rebuild docker containers when an updated image is detected
#!/usr/bin/env python
"""
script to rebuild the running containers if the images
on the registry have changed.
"""
import os
import pprint
import json
import yaml
Article updates everything below
https://sigmonsays.github.io/2017/11/why-use-the-go-programming-language/
newer 2019 reasons
https://yourbasic.org/golang/advantages-over-java-python/
- easy to learn
- compiled language checks a lot of errors for me
- statically compiled (single binary deployment!)
- strictly typed language
@sigmonsays
sigmonsays / dhcp-event
Created October 15, 2019 22:28 — forked from tomoconnor/dhcp-event
Thingy for updating powerdns backend when stuff changes
#!/usr/bin/env python
import MySQLdb
import os, sys
import pprint
pp = pprint.PrettyPrinter()
mysql_host = "localhost"
mysql_user = "dbusername"
mysql_pass = "dbpassword"
@sigmonsays
sigmonsays / custom
Created December 3, 2018 01:08 — forked from zoqaeski/custom
xkbcomp keyboard layout dump
// $XDG_CONFIG_HOME/xkb/symbols/custom
// Makes ALT + CAPS_LOCK act as 3rd level switch
// Works sporadically
partial modifier_keys
xkb_symbols "alt_caps_mode_switch" {
key <CAPS> {
type[Group1]="PC_ALT_LEVEL2",
[ Caps_Lock, ISO_Level3_Shift ]
};
@sigmonsays
sigmonsays / streaming-tar.py
Created June 22, 2018 22:52 — forked from chipx86/streaming-tar.py
Sample code to build a tar chunk-by-chunk and stream it out all at once.
#!/usr/bin/env python
#
# Building a tar file chunk-by-chunk.
#
# This is a quick bit of sample code for streaming data to a tar file,
# building it piece-by-piece. The tarfile is built on-the-fly and streamed
# back out. This is useful for web applications that need to dynamically
# build a tar file without swamping the server.
import os
import sys
@sigmonsays
sigmonsays / README.md
Created June 5, 2018 16:39 — forked from jhollinger/README.md
rbackup - time-stamped, hard-linked backups powered by rsync

rbackup

rbackup is a lightweight, rsync-powered backup utility that creates time-stamped backups.

Features

It can save backups to your local filesystem (probably an attached USB device) or to a remote host.

Backups are saved in time-stamped directories. Backups are cheap on storage, because hard-links are used for files that haven't changed between backups.

@sigmonsays
sigmonsays / gist:c911b618a970d9748ac877b736180a6a
Created April 16, 2018 14:52
why does mac os have to be case insensitive?
sig@sig-macbook:~$ head usage-by-user.log
curl: (6) Could not resolve host: usage-by-user.log
sig@sig-macbook:~$ type head
head is hashed (/Users/sig/bin/head)
sig@sig-macbook:~$ ls -l bin/HEAD
-rwxr-xr-x 1 sig staff 31 Feb 8 2016 bin/HEAD
@sigmonsays
sigmonsays / main.go
Created January 7, 2018 16:19 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@sigmonsays
sigmonsays / sshd.go
Created December 19, 2017 17:00 — forked from jpillora/sshd.go
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client: