This year i used safe fireworks.
A ledstrip ( about 600 leds ) controlled by an arduino.
Only problem is .. there is no sound, but i managed to fix that 🙂
This year i used safe fireworks.
A ledstrip ( about 600 leds ) controlled by an arduino.
Only problem is .. there is no sound, but i managed to fix that 🙂
Why “rubber ducking’’? While an undergraduate at Imperial College in London, Dave did a lot of work with a research assistant named Greg Pugh, one of the best developers Dave has known. For several months Greg carried around a small yellow rubber duck, which he’d place on his terminal while coding. ( From “The Pragmatic programmer” page 95)
Why rubber ducking?
A very simple but particularly useful technique for finding the cause of a problem is simply to explain it to someone else or even a object. Explain out loud (or in your mind to the duck) what each line of code is doing.
Often while doing so, you will see the problem.
Why Pair Programming?
It is no secret, i like working on a problem alone. Let me do my ‘thing’. But i like the idea of Pair Programming, why?
Changed some code controlling my wacom drawing tablet.
I use this one to draw Art, diagrams and touch up photo’s.
When using multiple screens, i had the problem it would stretch the draw area over multiple screens, streching the ratio. Or it took the work screen to work on.
#!/bin/bash
# using xinput here, check post about two mouses/keyboards on one machine
# Use xrandr to check names check
MONITOR="DP-1"
PAD_NAME='Wacom BambooFun 6x8 Pad pad'
#undo
xsetwacom --set "$PAD_NAME" Button 1 "key +ctrl +z -z -ctrl"
xsetwacom --set "$PAD_NAME" Button 2 "key e"
xsetwacom --set "$PAD_NAME" Button 3 "key h"
ID_STYLUS=`xinput | grep "Pen stylus" | cut -f 2 | cut -c 4-5`
xinput map-to-output $ID_STYLUS $MONITOR
ID_STYLUS_2=`xinput | grep "Pen eraser" | cut -f 2 | cut -c 4-5`
xinput map-to-output $ID_STYLUS_2 $MONITOR
exit 0
Most of the times i use Krita and Gimp.
Switches and access-points
Today i got my RB4011 ! Wooot!
Total tally
To replace .. 4 SLM2008 and a TPLink switch 🙂
I’ll be posting something about connecting an arduino to the serial console using a tcp server later.
Mikrotiks are all you can eat .. And there is a lot of functionality. One of the main features (besides being switches and routers)
Installing extra packages
I’ve got several AccessPoints in my network.
Using a roaming setup, clients can connect to strongest AP.
For our Folkband i’ve setup same.
With the exception of those clients only being able to connect to the Internet, and not the rest of my Network
/interface bridge
add name=bridgeguest
/interface wireless security-profiles
add authentication-types=wpa2-psk eap-methods="" management-protection=allowed mode=dynamic-keys name=guest supplicant-identity=MikroTikHAP wpa2-pre-shared-key=guestkey
/interface wireless
add disabled=no mac-address=MACADDRESS master-interface=wlan1 name=guest security-profile=guest ssid=guest station-roaming=enabled wds-default-bridge=bridge wps-mode=disabled
/ip pool
add name=guest ranges=10.5.0.2-10.5.0.250
/ip dhcp-server
add address-pool=guest disabled=no interface=bridgeguest name=dhcpserverguest
/interface bridge port
add bridge=bridgenb interface=guest
/ip address
add address=10.1.0.5/24 comment=defconf interface=ether2 network=10.1.0.0
add address=10.5.0.1/24 interface=bridgeguest network=10.5.0.0
/ip dhcp-client
/ip dhcp-server network
add address=10.5.0.0/24 dns-server=1.1.1.1 gateway=10.5.0.1
/ip dns static
add address=10.1.0.5 name=router.lan type=A
/ip firewall filter
add action=drop chain=input dst-address=10.1.0.5 dst-port=22,80,443,8291,21,23 protocol=tcp src-address=10.5.0.1-10.5.0.254
add action=drop chain=input dst-address=MYNETWORKSHERE/16 src-address=10.5.0.2-10.5.0.250
add action=drop chain=forward dst-address=MYNETWORKSHERE/16 src-address=10.5.0.2-10.5.0.250
add action=drop chain=forward dst-address=MYNETWORKSHERE/16 src-address=10.5.0.2-10.5.0.250
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN
add action=accept chain=srcnat src-address=10.5.0.0/24
A script to check the age of sensors.
Sometimes you don’t have a good 433Mhz connection.
Or the battery has died of your sensor.
This script will warn you.
sensoragescript.sh (for cron)
#!/bin/bash #Call as follows #sensoragescript.sh <ipdomoticz> <idx-of-sensor> <age-to-test-in-seconds> now=$(date +%s) lastupdate=$(curl -s -i -H "Accept: application/json" "http://$1:8080/json.htm?type=devices&rid=$2" | grep LastUpdate | cut -f4 -d\" ) #echo $lastupdate seen=$(date -d "$lastupdate" +%s) #echo $seen #echo "$(( $now - $seen))" difftime="$(( $now - $seen))" if [ $difftime -gt $3 ] ; then echo "WARN : too old - $difftime seconds" exit 1 else echo "OK : $difftime seconds" exit 0 fi
Outputs:
./new.sh 192.168.1.1 123 60 OK : 22 seconds ./new.sh 192.168.1.1 123 60 WARN : too old - 69 seconds
check_mk / icinga check
#!/bin/bash IPDOMO=192.168.1.1 IDX=123 agewarn=300 now=$(date +%s) lastupdate=$(curl -s -i -H "Accept: application/json" "http://$IPDOMO:8080/json.htm?type=devices&rid=$IDX" | grep LastUpdate | cut -f4 -d\" ) seen=$(date -d "$lastupdate" +%s) difftime="$(( $now - $seen))" if [ $difftime -gt $agewarn ] ; then echo "1 \"WARN - Age check Fridge\" realage=$difftime|age=$agewarn Age of fridge" exit 1 else echo "0 \"OK - Age check Fridge\" realage=$difftime|age=$agewarn Age of fridge" exit 0 fi