#!/bin/bash
echo -n "\""
for f in `cat "$1"` ;do echo "$f" | tr -cd "[A-HL]_[0-9]" ; echo ; done | grep -v '^$' |grep _ > /tmp/parsons
let count=0
for f in `cat /tmp/parsons| tr -cd "[A-HL] \n"` ;do
if [ "$f" = "LG" ] ; then g=0; fi
if [ "$f" = "LA" ] ; then g=1; fi
if [ "$f" = "B" ] ; then g=2; fi
if [ "$f" = "C" ] ; then g=3; fi
if [ "$f" = "D" ] ; then g=4; fi
if [ "$f" = "E" ] ; then g=5; fi
if [ "$f" = "F" ] ; then g=6; fi
if [ "$f" = "HG" ] ; then g=7; fi
if [ "$f" = "HA" ] ; then g=8; fi
if [ $count -eq 0 ] ;then
echo -n "*";
((count++))
last=$g
else
if [ "2$g" -eq "2$last" ] ; then echo -n "r" ; fi
if [ "2$g" -lt "2$last" ] ; then echo -n "d" ; fi
if [ "2$g" -gt "2$last" ] ; then echo -n "u" ; fi
last=$g
fi
done
echo "\""
Just place all files in a directory on a php enabled webserver. The bash script is being run daily. (parsons bash script is called from this main script) These will generate 2 files One with the filename and all useful text like composers. And a file with the filename and the parsons code. Example:
11th of September, The.bww,"*udduddudduddudurrdudrrdudduddudrrduuuuududurrdudrrurrdududurrdudrrduddudurrduudduddudduddududdurdudrurdduddududr
urduuudrduddurdudrudrurduududdurdudrurdduddururdududduddudduddudruddudruddudduddudruddruududududududrudurddrududruddudrudduddudurddrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrud
rrudrrudrrudrrudrrudrrudrrudrrudrrudrruuduuduuduuduuduuudrduuduurduuduuurdrduuduuduuuduurduuduuduuduuduu"
xrandr is an official configuration utility to the RandR (Resize and Rotate) X Window System extension. It can be used to set the size, orientation or reflection of the outputs for a screen.
Someone broke my screen at a hackers event. The terminal was really hard to read with the black parts, so i tilted the screen
Broken screen in 2013
Quiet friday at work, playing with my little trusty 2530p. I’m using xmonad, so i don’t need any fancy work laptop.
Fun with distorting the screen
Another quiet friday at work, working from home, i turned all monitoring displays upside-down, sideways, or rotated them every so much seconds.
While this is a lot of fun to use, i used this to get my monitorsetups exactly the way i wanted, at home or at work. Different screen sizes, height differences .. no problem.
A fun tool to use is: https://github.com/qurn/xrandr-keystone-helper
Trying to fix a computer from my computer collection.
Comx-35 (1983)
RCA 1802 CPU @ 2.8 Mhz
32K Memory
Apparenty something wrong with the graphics chip.
The COMX uses the RCA CDP1869 and CDP1870 Video Interface System (VIS), consisting of the CDP1869 address and sound generator and the CDP1870 colour video generator.
Maybe next to try : checking signals using a Logic Analyzer
Never ask me to reset your password, i you are to stupid to remember or not using a passwordsafe … I WILL give you a new password, and you WILL remember not having to ask me again. 🙂 On this day i drew some example pictures for colleages.
Okay .. now some tips to create uniq passwords for every site in you head.
NOTES! .. CNN example uses google as secret key .. Want to type faster and not using mouse? .. Press home!
Type website
dirkjan (press home)
(press right) s
(press right) e
(press right) c
(press right) r
(press right) e
(press right) t
dsierckrjeatn <- your password
Some websites use ajax and dynamic viewing of larger images. For a colleage i grabbed a screenshot using below to get him a full sized campsite map.
Firefox example: Open the page, google maps for example. Press CTRL+SHIFT+M or Responsive Design View from the Developers Tools.
Change the size you want your virtual browser ( and doing so, your screenshot size here 2800 ) And click on the ‘take screenshot from viewport’ icon on the right.
A friend of mine wanted to monitor his UPS using domoticz. This UPS only had a simple web interface with information.
So we needed to scrape this information and push this into domoticz.
First create a dummy device in domoticz and note its IDX.
Then we can scrape needed information using below script.
#!/bin/bash
#set -x
# Domoticz server
SERVER="127.0.0.1:8080"
# APC Back-UPS HS 500 status URL
UPS="http://IP-OF-UPS/status.cgi"
# The number of the IDX in the list of peripherals
IDX="362"
# Path for temporary file (RAM drive)
TMPFILE="/tmp/apc-hs500-status.txt"
# Get APC Back-UPS HS 500 status and write to temporary file
wget $UPS -O $TMPFILE 2>/dev/null
if [ $? = 0 ]
then
PWR=$(cat $TMPFILE| tr -dc '[[:print:]]' |awk -F"Watts" '{print $1}' |rev |cut -f1 -d\> |rev |cut -f1 -d\&)
fi
if [ $PWR ]
then
echo "Load on Battery in Watts: $PWR"
# Send data to Domoticz
curl -s -i -H "Accept: application/json" "http://$SERVER/json.htm?type=command¶m=udevice&idx=$IDX&nvalue=0&svalue=$PWR"
PWR=""
fi
rm $TMPFILE
It uses canvas to draw lines and text, but thats only interesting for static stuff. ( https://www.w3schools.com/graphics/canvas_drawing.asp ) My example uses a php script to load information from a csv file. And loops though those entries and draw lens info.
Later i made a script to push this information in Grafana
Now for the SSH part. I’m jumping from machine to machine using ssh, sometime i loop back to a server i was already connected to .. this helps me to keep track
in ssh_config add
SendEnv SSHTRAIL
in sshd_config add
AcceptEnv SSHTRAIL
in /etc/profile
export SSHTRAIL=$SSHTRAIL:$HOSTNAME
restart sshd
when you do this on all your machines you can get a trail of ssh using:
echo $SSHTRAIL
workstation:server1:server66:server1
I could change the prompt when a loop is detected
echo $SSHTRAIL | sed -e 's/:/\n/g' | sort | uniq -c | grep -v 1 | ... | echo "WARNING: loop in ssh"
"If something is worth doing, it's worth overdoing."