Skip to content

Instantly share code, notes, and snippets.

milkpirate

  • Berlin
View GitHub Profile
@milkpirate
milkpirate / python2-for-apt.sh
Last active Aug 18, 2018
Force apt(-get) files to be executed with python2 - useful for debian, if you set e.g. python3 as system default
View python2-for-apt.sh
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 Mar 28, 2019
Python update alternatives - summary
View update-alternatives
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 Mar 16, 2017
Icinga plugin - core frequencies
View cpu_monitor.sh
#!/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}' \
You can’t perform that action at this time.