Since the implementation of Arrays in Bash is somewhat lacking compared to higher level programming languages (only one-dimensional), and hash lists require a bit of work to set up, you may run into a situation where you have a small list of key/value pairs that are both variable and you need to store. There are [...]
Category > Programming
Farmville
Farmvill can be a fun way to pass some time, but if your fields get to be a bit big clicking on every single field can get to be a bit tiresome. I found this autohotkey script in the depths of the internet. It simplifies the process greatly Text | copy code |? 01 02!^c::03GoSub GetFarmSq04GoSub Getfirstsq05 06i=107 08SetMouseDelay, 009 10cycle := farmy/211newx=%startx%12newy=%starty%13loop, [...]
bash scripting … switching into directory of the script
Sometimes it is useful to switch into the directory of the script e.g. when we need to call or include further files and don’t want to go through the hassle of searching for the script in the file system. Especially when symlinks are involved everything get a bit more interesting. This little snippet switches into [...]
Bash scripting, traps and sleep
Today I ran into any old problem: you have a script that should do something when it recieves a signal (e.g. if someone sends it USR1 it should write to a log/syslog), but the script uses a long sleep because it normally only checks/calculates stuff every x min. If you send it a kill -USR1 [...]


