Skip to content

Instantly share code, notes, and snippets.

View michaeldorner's full-sized avatar

Michael Dorner michaeldorner

View GitHub Profile
@michaeldorner
michaeldorner / vpnc.sh
Last active September 19, 2025 11:12
OpenConnect GlobalProtect wrapper for vpn.ohmportal.de with macOS Keychain support
#!/bin/bash
PORTAL="vpn.ohmportal.de"
# Get username from Keychain
USER=$(security find-generic-password -s "$PORTAL" -g 2>&1 | \
awk -F\" '/"acct"<blob>="/ {print $(NF-1); exit}')
# Get password from Keychain
PASS=$(security find-generic-password -s "$PORTAL" -w 2>/dev/null)
@michaeldorner
michaeldorner / environments_svjour3.tex
Created July 28, 2025 15:13
Missing environments for the required, yet not provided funding, data availability, conflicts of interests, and authors' contribution statements in svjour3 (Springer) LaTeX template
% add before \begin{document}
\newenvironment{funding}{\def\ackname{Funding}\begin{acknowledgement}}{\end{acknowledgement}}
\newenvironment{dataavailability}{\def\ackname{Data Availability}\begin{acknowledgement}}{\end{acknowledgement}}
\newenvironment{conflictsofinterest}{\def\ackname{Conflict of Interest}\begin{acknowledgement}}{\end{acknowledgement}}
\newenvironment{authorscontributions}{\def\ackname{Authors’ Contributions}\begin{acknowledgement}}{\end{acknowledgement}}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
\documentclass{article}
\usepackage{pgffor}
\usepackage{pgfkeys}
\usepackage{ifthen}
\pgfkeys{
/contributions/.cd,
1/.initial=Conceptualization,
2/.initial=Methodology,
@michaeldorner
michaeldorner / github_retry.py
Last active March 8, 2025 20:49
urllib3 and requests retry for REST and GraphQL GitHub API
from time import sleep, time
from datetime import timedelta
import requests
from requests.adapters import HTTPAdapter, Retry
API_URL = 'https://api.github.com/' # or 'https://api.github.com/graphql' or others
API_TOKEN = '' # You will need that
TIMEOUT = 10
\documentclass[margin=1cm]{standalone}
\usepackage{tikz}
\definecolor{ACMYellow}{RGB}{255, 214, 0}
\definecolor{ACMOrange}{RGB}{252, 146, 0}
\definecolor{ACMRed}{RGB}{253, 27, 20}
\definecolor{ACMLightBlue}{RGB}{131, 206, 226}
\definecolor{ACMGreen}{RGB}{166, 188, 9}
\definecolor{ACMPurple}{RGB}{101, 1, 107}
\definecolor{ACMDarkBlue}{RGB}{9, 53, 122}
from pathlib import Path
lines_not_200 = []
log_file_dir = '.'
for log_file in Path(log_file_dir).glob('*.log'):
with open(log_file, 'r') as f:
for line in f.readlines():
if not line.startswith('INFO:root:HTTP status 200'):
lines_not_200 += [line]
import timeit
import pandas as pd
import matplotlib.pyplot as plt
# measuring
numpy_results = {}
python_results = {}
config = {'number': 100, 'repeat': 100}
import bz2
import orjson
from requests.adapters import HTTPAdapter, Retry
from requests_cache import CachedSession, SerializerPipeline, Stage, serializers
from requests_futures.sessions import FuturesSession
SERIALIZER = SerializerPipeline([
serializers.preconf.orjson_preconf_stage,
orjson,
import shutil
from pathlib import Path
data_dir = './data' # please speficy the data dir
for path in Path(data_dir).rglob('timeline'):
print(path)
shutil.rmtree(path)