Skip to content

Instantly share code, notes, and snippets.

@milkpirate
milkpirate / onimage.dtx
Created March 2, 2026 19:05 — forked from samuelstjean/onimage.dtx
onimage latex class to use tikz in a relative coordinate system
% Sam : Original is hosted here https://code.launchpad.net/~tex-sx/tex-sx/development
% run latex/pdflatex on the dtx file to produce the class file
% \iffalse meta-comment
%<*internal>
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
%</internal>
@milkpirate
milkpirate / python2-for-apt.sh
Last active August 18, 2018 20:45
Force apt(-get) files to be executed with python2 - useful for debian, if you set e.g. python3 as system default
cd /usr/share/python/debpython/
\ls /usr/share/python/debpython/*.py | xargs sed -i.bak '1s|^|#!/usr/bin/env python2\n|'
cd /usr/bin/pycompile
\ls /usr/bin/pycompile | xargs sed -i '1s|^|#!/usr/bin/env python2\n|'
@milkpirate
milkpirate / update-alternatives
Last active March 28, 2019 22:23
Python update alternatives - summary
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
update-alternatives --list python
sudo update-alternatives --config python
sudo update-alternatives --set pager /bin/less
@milkpirate
milkpirate / cpu_monitor.sh
Created March 16, 2017 19:49
Icinga plugin - core frequencies
#!/usr/bin/env bash
#
# Read core number from /proc/cpuinfo and display frequency of each
# count the processor fields and display the number
awk '/processor/ {core_count++} END{print "CPU OK:", core_count, "CPUs;"}' \
/proc/cpuinfo
# get the frequency for each core and keep track of core id via counter
awk 'BEGIN{printf "| "} /cpu MHz/ {print core_id++ "=" $4}' \