Skip to content

Instantly share code, notes, and snippets.

Avatar

Wolfgang Schnerring wosc

View GitHub Profile
@wosc
wosc / README.md
Created Jul 8, 2021
Creating tracing data from an haproxy access log via fluent bit and opentelemetry collector
View README.md

Creating opentelemetry tracing data from an haproxy access log

Approach

Unfortunately, otelcol currently has no receiver for logfiles that produces tracing data. There is log tailing functionality, and e.g. a fluent forward protocol receiver, but they all create "log" data, not tracing. I've seen this proof of concept to implement a forward receiver that creates tracing data, but that seems to have no traction and no relation to the upstream project at all (not even git history.

Thus, we've settled on this approach:

@wosc
wosc / mac-open-terminal-and-wait.sh
Created Jan 12, 2019
Launch a command in a new macOS terminal window and block until it exits
View mac-open-terminal-and-wait.sh
#!/bin/bash
# Adapted from https://github.com/jlebon/files/blob/master/bin/gnome-terminal-wrapper
set -euo pipefail
# Needs `flock` command from https://github.com/discoteq/flock
# which can be installed via homebrew (which is not on the PATH by default)
export PATH=/usr/local/bin:$PATH
tmpf=$(mktemp)
trap "rm -f $tmpf" EXIT
@wosc
wosc / Vagrantfile
Created Dec 18, 2018
Build unison-2.51.2 deb, compatible with the MacOS binary release
View Vagrantfile
Vagrant.configure("2") do |config|
config.vm.define "default" do |default|
default.vm.hostname = "unisonbuild"
default.vm.provider "lxc"
default.vm.box = "zeitonline/bionic64-lxc"
# default.vm.box = "bento/ubuntu-18.04"
end
end
@wosc
wosc / backup-shaarli.sh
Created Mar 29, 2018
Automated export of bookmarks from Shaarli
View backup-shaarli.sh
#!/bin/bash
# Export bookmarks from Shaarli <https://github.com/shaarli/Shaarli> in Netscape HTML format.
# Adapted from <https://github.com/nodiscc/shaarchiver>
url=$1
user=$2
pass=$3
cookies=$(mktemp)
curl="curl -s --cookie-jar $cookies --cookie $cookies"
@wosc
wosc / routing.yml
Created Jul 14, 2016
Enable basic auth for wallbag export by adding these configuration statements (files are in app/config/)
View routing.yml
backup:
path: "/backup/{category}.{format}"
defaults:
_controller: WallabagCoreBundle:Export:downloadEntries
requirements:
category: all|unread|starred|archive
format: epub|mobi|pdf|json|xml|txt|csv
View delicious2netscape.py
#!/usr/bin/env python
import json
import sys
# See https://msdn.microsoft.com/en-us/library/aa753582%28VS.85%29.aspx
# and https://github.com/shaarli/Shaarli/blob/v0.6.5/index.php#L1899
HEADER = u'<!DOCTYPE NETSCAPE-Bookmark-file-1><DL>'
FOOTER = u'</DL>'
ITEM = u'<DT><A HREF="{url}" ADD_DATE="{time_created}" TAGS="{tags}">{title}</A>'
@wosc
wosc / backup-delicious.py
Created Apr 13, 2016
Backup all your delicious.com bookmarks by scraping the UI-facing API
View backup-delicious.py
import json
import requests
import sys
BASE_URL = 'https://avosapi.delicious.com/api/v1/posts/you/time'
def get_bookmarks(entry, auth):
if not entry:
r = requests.get(BASE_URL, auth=auth)
@wosc
wosc / slack-readline.user.js
Created Feb 18, 2015
Greasmonkey User Script for Slack: Restore Readline Keybindings
View slack-readline.user.js
// ==UserScript==
// @name Slack: Restore Readline Keybindings
// @namespace http://wosc.de/
// @version 1.0
// @description Don't let Slack capture keybindings for C-u and C-k (use C-o to open omnibox instead)
// @author Wolfgang Schnerring <wosc@wosc.de>
// @match https://*.slack.com/*
// @grant none
// ==/UserScript==
View keybase.md

Keybase proof

I hereby claim:

  • I am wosc on github.
  • I am wosc (https://keybase.io/wosc) on keybase.
  • I have a public key whose fingerprint is D062 178B 7F40 C78F 7724 24CE 61F5 821D E73B C3B4

To claim this, I am signing this object:

View gist:5141422
def alias(column_name):
"""returns a descriptor that is usable everywhere the original column name
was: (not really a doctest, sorry)
>>> class Foo(SQLBase):
... original = Column(Integer)
... new = alias('original')
>>> foo = Foo()
>>> foo.new = 5