Skip to content

Instantly share code, notes, and snippets.

View 0-andy-0's full-sized avatar

Andrew Tonks 0-andy-0

  • University of Málaga
View GitHub Profile
@0-andy-0
0-andy-0 / agp.sh
Last active October 9, 2025 14:32
live window background streaming from AGP
# choose the widest possible monitor and use winwrap to play a youtube video as its background
export xwMON=$(xrandr|grep " connected"|tr " " "\n"|grep "[0-9]x[0-9]"|sort -nr|head -1)
export xwURL=https://youtu.be/A6R81wOlQqs
while true
do xwinwrap -ni -nf -b -un -fdt -g $xwMON -- mpv -wid WID --really-quiet --no-audio $xwURL
sleep 1
date
done
@0-andy-0
0-andy-0 / 8-bit-color.zsh
Last active September 13, 2024 14:01
8-bit color
# set fore- and optionally back-ground 8-bit color
colour () {while IFS= read -r line; do printf "\x1B[38;5;$1m\x1B[48;5;${2:-0}m%b\x1B[0m\n" "$line"; done}
# bright yellow on 1/3 gray
echo testing | colour 11 240
# print complete 8-bit colormap
for i in {0..255
do if (($i==0)); then echo "0-7, 8-15: basic colors"; fi
if (($i==16)); then echo " 16 - 231: 6x6x6 colormap"; fi
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [["$","$"], ["\\(","\\)"]]}});
</script>
<script type="text/javascript" async src=
"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js?config=MML_HTMLorMML" CHOOSE
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS_CHTML" ONE!
></script>
@0-andy-0
0-andy-0 / compile.sh
Last active September 23, 2020 18:02
~/perl5/bin/cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
theFile="$(basename -s.tex $1)"
theSite="$theFile"-site/
rm -rf "$theSite"
latexml "$theFile".tex --dest="$theFile".xml --quiet
grep -h font=\"[a-z]*\ "$theFile".xml|sort|uniq
sed -E -e 's/font=\"([a-z]*) (upright|serif|medium)\"/font=\"\1\"/g' -e 's/font=\"(upright|serif|medium) ([a-z]*)\"/font=\"\2\"/g' -i'-old' "$theFile".xml
latexmlpost "$theFile".xml --dest="$theSite"/index-split-at-sect.html --quiet --split --navigationtoc=context --javascript="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js?config=MML_HTMLorMML" --css=andy-navbar.css --css=normalize.css --urlstyle=file --timestamp=0
latexmlpost "$theFile".xml --dest="$theSite"/whole-thing.html --quiet --quiet --navigationtoc=context --javascript="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js?config=MML_HTMLorMML" --css=andy-navbar.css --css=normalize.css --urlstyle=file --timestamp=0 --javascript=andy-navbar.js
sed -i 's/<hea

obs-v4l2sink-git

v4l2loopback-dkms

modprobe v4l2loopback video_nr=9,10 card_label=Remarkable,OBS exclusive_caps=1

xsetwacom set 17 "Area" "0 0 32767 32767"
xsetwacom set 17 MapToOutput 1920x1280+1924+0

grab the lines we want, remove repeated spaces and new lines, put back linebreaks starting with TWo capitals

pdftops IN.pdf - | ps2ascii | egrep "(,|MA|Credits)" \
                 | tr -s " \012\015" ' __' \

| sed 's/+ *(.[a-z])/ | \1/g'|sed 's/+ */\n/g'

@0-andy-0
0-andy-0 / cpu-one-liners.md
Last active September 13, 2024 12:36
cpu frequency scaling, load, temperature

CPU state

frequencies

grep cpu\ MHz /proc/cpuinfo |sed 's/.*: //'

current cpu usage/loads (* means include cpu average, also cpu1, cpu2, cpu3, ...)

awk -v a="$(awk '/cpu[0-9]* /{print $2+$4,$2+$4+$5}' /proc/stat; sleep 0.8)" -v 'OFMT=%3.1f%%' '/cpu[0-9]* /{split(a,b," "); print 100*($2+$4-b[2*NR-1])/($2+$4+$5-b[2*NR])}'  /proc/stat

temperatures (stored as xx000 degees!)

grep -h 000  /sys/devices/**/temp*| sed 's/000$/⁰C/'
@0-andy-0
0-andy-0 / streaming.md
Last active July 4, 2020 19:06 — forked from atlury/vlc-stream.sh
Cam & screen streaming from Android (with app) or PC (with vlc), with mjpeg playback via browser or vlc again

stream pc screen to http port 18223

DISPLAY=:0 cvlc --no-audio screen:// --screen-fps 1 --sout "#transcode{vcodec=MJPG,vb=800}:standard{access=http,mux=mpjpeg,dst=:18223/}" --sout-http-mime="multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a"

playback URL http://my-hostname-or-my-ip:18223, on any device, e.g.

cvlc --demux=mjpeg --network-caching=0 http://localhost:18223
midori  http://localhost:18223
brave-beta http://localhost:18223
xdg-open http://localhost:18223