Skip to content

Instantly share code, notes, and snippets.

Avatar

Niko Dittmann niko

View GitHub Profile
@niko
niko / README.md
Last active Dec 14, 2020 — forked from ePirat/spec.md
Icecast Protocol specification
View README.md

An collection of documents about icecast/shoutcast streaming.

View consul-template-jsonparse-crash.debug.log
consul-template --template foo.ctmpl -dry -log-level=trace -consul-addr=172.17.0.1:8500
2019/09/26 09:25:51.867140 [INFO] consul-template v0.22.0 (005b42eb)
2019/09/26 09:25:51.867153 [INFO] (runner) creating new runner (dry: true, once: false)
2019/09/26 09:25:51.867390 [DEBUG] (runner) final config: {"Consul":{"Address":"172.17.0.1:8500","Auth":{"Enabled":false,"Username":"","Password":""},"Retry":{"Attempts":12,"Backoff":250000000,"MaxBackoff":60000000000,"Enabled":true},"SSL":{"CaCert":"","CaPath":"","Cert":"","Enabled":false,"Key":"","ServerName":"","Verify":true},"Token":"","Transport":{"DialKeepAlive":30000000000,"DialTimeout":30000000000,"DisableKeepAlives":false,"IdleConnTimeout":90000000000,"MaxIdleConns":100,"MaxIdleConnsPerHost":9,"TLSHandshakeTimeout":10000000000}},"Dedup":{"Enabled":false,"MaxStale":2000000000,"Prefix":"consul-template/dedup/","TTL":15000000000},"Exec":{"Command":"","Enabled":false,"Env":{"Blacklist":[],"Custom":[],"Pristine":false,"Whitelist":[]},"KillSignal":2,"KillTimeout":30
View zsh_opts
# https://stackoverflow.com/questions/171563/whats-in-your-zshrc
#{{{ ZSH Modules
autoload -U compinit promptinit zcalc zsh-mime-setup
compinit
promptinit
zsh-mime-setup
#}}}
View zshrc
# The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' completions 1
zstyle ':completion:*' glob 1
zstyle ':completion:*' max-errors 0
zstyle ':completion:*' prompt 'errors: %e '
zstyle ':completion:*' substitute 1
zstyle :compinstall filename '/home/niko/.zshrc'
View vimrc
set nocompatible
set number
" show invisible characters:
set list
set listchars=tab:▸\ ,eol
set listchars+=trail:˙
" allow buffer changes without saving:
View stream_watch.sh
#!/bin/bash
trap 'pkill -P $$' INT TERM EXIT
for s in "$@"; do
(
while true; do
t=$(date +'%Y-%m-%d_%H:%M:%S')
echo "${t} started ${s}"
curl --silent --show-error -H 'user-agent: stream-watch.sh' "${s}?test-ice-${t}" | wc -c
View keybase.md

Keybase proof

I hereby claim:

  • I am niko on github.
  • I am nikod (https://keybase.io/nikod) on keybase.
  • I have a public key whose fingerprint is 1A19 55CF EF33 A1D2 8E86 1D23 66B2 2F68 EB65 349D

To claim this, I am signing this object:

View lautfm-ping.php
<?php
header('Content-Type: text/plain');
function ping($addr){
$starttime = microtime(true);
$file = fsockopen ($addr, 80, $errno, $errstr, 10);
$stoptime = microtime(true);
$status = 0;
if (!$file) $status = -1; // Site is down
View sinatra_background_threadpool.rb
# ala https://www.onli-blogging.de/1463/Sinatra-Code-im-Hintergrund-ausfuehren.html
require 'sinatra/base'
require 'thread/pool'
class Transcode
ThreadPool = Thread.pool(2)
def initialize message
ThreadPool.process do
@niko
niko / README.md
Last active Aug 7, 2019
i3wm & mutt: check mails, blink caps lock led, mark mail workspace as urgent.
View README.md

This puzzle has 3 parts:

  • A i3wm config that opens mutt in a dedicated workspace. $mod+m will switch to this workspace and will launch mutt, if not already running. Actually it doesn't launch mutt, but…
  • a small wrapper script, which opens a named pipe and then starts mutt.
  • a checkmail script which uses mailcheck(1) to tara check mail. If new mail is available, it blinks the CAPS LOCK led (which I mapped to CTRL anyway) and marks the mutt workspace via a bell.

Additional configuration:

  • set your terminal to mark urgent bells. In Termite the setting is "urgent_on_bell = true".
  • adopt you ~/.mailcheckrc to include paths to your mailboxes. In the simplest case it contains just the line "$(HOME)/Maildir/INBOX"