Skip to content

Instantly share code, notes, and snippets.

View rometsch's full-sized avatar

Thomas Rometsch rometsch

  • University of Heidelberg
View GitHub Profile
@rometsch
rometsch / numa.py
Created December 22, 2022 14:38
Obtain information about the numa topology of the system.
import os
import re
def get_numa_nodes():
"""Return the numa topology of the system.
Data is extracted from /sys/devices/system/cpu.
The numa nodes on the system are the keys of the dictionary.
Each value is a list of tuples which themselves represent physical cores.
Each tuples contains the id of the threads belonging to the physical core.
@rometsch
rometsch / plotly_ping.py
Last active April 15, 2021 22:48
Show timeseries and histogram of output from ping -D
#!/usr/bin/env python3
import argparse
import re
from datetime import datetime
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
@rometsch
rometsch / ncdu_user_install.sh
Created September 23, 2020 13:02
ncdu - clone, compile, install
#!/usr/bin/env bash
TMPDIR=$(mktemp -d)
cd $TMPDIR
git clone git://g.blicky.net/ncdu.git/
cd ncdu
autoreconf -i
@rometsch
rometsch / BH456A_linux_driver.md
Last active October 16, 2023 08:16
MPOW BH456A Bluetooth USB Adapter Kernel Module Adjustements (Realtek RTL8761B chip)

Problem

The MPOW Bluetooth 5 dongle (Model: BH456A) does not work out of the box on Ubuntu 20.04 (kernel 5.4.0-42).

Solution

Patch the bluetooth kernel module and copy the firmware binaries to /lib/firmware.

Copy the fimware

@rometsch
rometsch / boulder_prices.py
Created November 15, 2019 18:23
Compare prices for bouldering hall in Tübingen using python and matplotlib.
#!/usr/bin/env python3
# Compare different scenarios for Boulder entry fee in Tübingen
import numpy as np
import matplotlib.pyplot as plt
from pprint import pprint
def main():
Ns = np.arange(20,80)
scenarios = build_scenarios()
@rometsch
rometsch / scale_tv.sh
Created March 31, 2018 20:36
Bash script to connect a TV to HDMI-2 which implements HDMI in a strange way
#!/usr/bin/env bash
xrandr --output HDMI-2 --mode 1920x1080i
intel_panel_fitter -p B -x 1734 -y 1030
@rometsch
rometsch / setUserAgentFirefox.md
Created September 28, 2017 01:50
User Agent String in Firefox

Set User Agent Sting in Firefox

The user agent string is part of the header of any HTTP request and tells the webserver about the type of browser and about the operating system. In Firefox it can be set by navigating to about:config and adding the entry general.useragent.override.

Here is an example user agent string for a Linux desktop system:

Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1

GPIB interfacing using Agilent 82357B on Ubuntu Linux

This is a fork of the original version to make the same setup run on a newer version of Ubuntu 16.04.2 LTS.

I initially had some problems installing on my laptop, so decided to boot Ubuntu 12.04.5 LTS, 3.13.0-32-generic from USB and work from there.

Download the linux-gpib package, unpack and build. Get python-setuptools first for later Python bindings support.

@rometsch
rometsch / i3autolock.md
Last active October 6, 2024 08:00
Configure lockscreen for i3 window manager.

The i3-wm does not come with a keybinding to lock the screen or a preconfigured auto lockscreen. This gist describes how to setup both using i3lock and xautolock. i3lock is a minimalistic lockscreen and xautolock monitors mouse and keyboard activities to automatically lock the screen after a certain time of beiing inactive.

First get the tools if neccessary. E.g. sudo apt install i3lock xautolock.

To setup the keybinding Ctrl+Alt+l (last one is a lowercase L) to lock the screen append the following lines to the i3 configuration file located at ~/.config/i3/config.

# keybinding to lock screen