Skip to content

Instantly share code, notes, and snippets.

☕️
a damn fine cup of coffee

Andreas Linz klingtnet

Block or report user

Report or block klingtnet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@klingtnet
klingtnet / benchmark-cpu-vulnerability-mitigations.md
Last active May 17, 2019
Benchmark CPU vulnerability mitigtations
View benchmark-cpu-vulnerability-mitigations.md

Kernel options:

$ curl -s 'https://make-linux-fast-again.com/'
noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off mitigations=off

Rust's click library was compiled as a benchmark (CPU bound on my machine (Lenovo X1C5):

@klingtnet
klingtnet / handle-http-client-timeout.go
Created Mar 21, 2019
Handle HTTP client timeout in Go
View handle-http-client-timeout.go
package main
import (
"io/ioutil"
"log"
"net/http"
"net/http/httptest"
"net/url"
"time"
)
@klingtnet
klingtnet / modern-python-project-setup.md
Created Feb 27, 2019
WIP: Modern Python Project Setup
View modern-python-project-setup.md
@klingtnet
klingtnet / uhe-linux-all.sh
Last active Feb 10, 2019
Install all u-he x64 linux betas
View uhe-linux-all.sh
#!/bin/bash
set -euo pipefail
SYNTHS=(ACE Bazille ColourCopy Diva Filterscape Hive Podolski Presswerk Repro-1 Satin TrippleCheese Twangstrom Uhbik Zebra2)
_TMPDIR=$(mktemp -d --suffix=_uhe)
for SYNTH in ${SYNTHS[@]}; do
_URL="https://www.u-he.com/downloads/linux/beta/${VERSION}/${SYNTH}-${VERSION}.tar.xz"
echo Downloading $_URL and extracting to $_TMPDIR
@klingtnet
klingtnet / tcp-server.rs
Created Oct 29, 2018
Rust TCP to STDOUT server
View tcp-server.rs
use std::io;
use std::net::{TcpListener, TcpStream};
fn handle_client(mut stream: TcpStream) {
let sout = io::stdout();
let mut sout_handle = sout.lock();
io::copy(&mut stream, &mut sout_handle).expect("failed to copy into stdout");
}
fn main() -> io::Result<()> {
@klingtnet
klingtnet / how-to-make-beautiful-call-graphs-for-rust.md
Created Oct 7, 2018
How to make beautiful call graphs for Rust
View how-to-make-beautiful-call-graphs-for-rust.md

I found the instructions in this [reddit comment][reddit] by the user fn_rust. Dependencies:

The instructions are illustrated on the [rb][rb] crate:

  1. Build a binary with debug symbols (no --release flag was given): cargo build --example saw
@klingtnet
klingtnet / how-to-upgrade-nvmw-ssd-firmware-on-linux.md
Last active May 22, 2019
How to upgrade [Lenovo] NVMe SSD firmware on Linux
View how-to-upgrade-nvmw-ssd-firmware-on-linux.md

The instructions were tested on a Lenovo X1 Carbon 5th Gen (X1C5) on Arch Linux but should be applicable to other Lenovo models and Linux distributions.

BACKUP YOUR DATA! I created a bootable Ubuntu Image like this:

$ sudo sh -c 'curl --location --silent --fail "http://releases.ubuntu.com/18.04/ubuntu-18.04.1-desktop-amd64.iso" | pv > /dev/<your-usb-drive>'
# note that pv is only there to show progress, it is perfectly fine to redirect curl to the usb drive directly.

then I booted from this drive by pressing F12 on reboot and dumped my NVMe disk to an external hard drive like this:

@klingtnet
klingtnet / random-login-dialog-appearing-in-xscreensaver.md
Created Aug 29, 2018
Random login dialog appearing in xscreensaver
View random-login-dialog-appearing-in-xscreensaver.md

Random login dialog appearing in xscreensaver

If you're running XFCE then the solution is pretty simple, deactivate xfce-power-manager's presentation mode. In presentation mode the xfce-power-manager is sending keystrokes to keep the display awake. You can disable this mode by right clicking on the tray icon or by running:

$  xfconf-query --channel xfce4-power-manager --property /xfce4-power-manager/presentation-mode --set false
@klingtnet
klingtnet / How-to-unmount-webdrives-on-shutdown-with-systemd.md
Last active Aug 5, 2018
How to unmount webdrives on shutdown with systemd
View How-to-unmount-webdrives-on-shutdown-with-systemd.md

The systemd service file that is triggered before the shutdown.target (note that systemd targets are somewhat similar to RunLevels of SysVinit):

# /etc/systemd/system/unmount-webdrives-on-shutdown.service
[Unit]
Description=Unmount webdrives before shutdown
Before=shutdown.target

[Service]
Type=oneshot
ExecStart=/bin/bash /usr/local/bin/unmount-webmounts.sh
@klingtnet
klingtnet / setup-adblock-on-openwrt.md
Created Aug 3, 2018
How to setup adbock on an OpenWRT router
View setup-adblock-on-openwrt.md

How to setup adbock on an OpenWRT router

The following commands were used for a TP-Link WDR3500 with OpenWRT 18.06 and LuCI installed.

  1. ssh into the router

  2. Install the required packages

$ opkg install adblock luci-app-adblock ca-bundle ca-certificates libustream-openssl uclient-fetch
You can’t perform that action at this time.