I decided to create a repository containing the stuff i published without being part of a standalone repository; so this would be the shelter for scripts like pmv, rotating-cube, word-challenge-hacked ecc. ecc.
The name of the repository is hacks.
I decided to create a repository containing the stuff i published without being part of a standalone repository; so this would be the shelter for scripts like pmv, rotating-cube, word-challenge-hacked ecc. ecc.
The name of the repository is hacks.
Here is a new script for the subversion post-commit hooks.
It creates a rss feed containing information about the latest commit of collection of repositories.
#!/usr/bin/env bash
DESTINATION="/var/www/hacks/svn-feed"
ENTRIES="$DESTINATION/entries"
RSS="$DESTINATION/feed.xml"
TITLE='MLDB: Svn RSS'
LINK='http://matteolandi.no-ip.org/svn-browse'
DESCRIPTION='RSS feeds of the commits'
LAST_BUILD_DATE="`date -R`"
if [ $# -lt 2 ]; then
printf "Usage: $0 path revision\n"
exit 1
fi
REPO="$1"
PROJECT="`basename $REPO`"
REVISION=$2
OLD=$(( $REVISION - 1 ))
TEMP="`mktemp`"
printf "$PROJECT\n" >> $TEMP
svn log file://"$REPO" -r $REVISION >> $TEMP
cat $ENTRIES >> $TEMP
mv $TEMP $ENTRIES
printf "\n" > $RSS
printf "\n" >> $RSS
printf "\n" >> $RSS
printf "\n" >> $RSS
printf "
$LINK\n" >> $RSS
printf "$DESCRIPTION \n" >> $RSS
printf "$LAST_BUILD_DATE \n" >> $RSS
cat $ENTRIES | while read line; do
repo="$line"
read line
read line
revision=`echo $line | cut -d '|' -f 1 | tr -d ' r'`
author=`echo $line | cut -d '|' -f 2 | tr -d ' '`
day=`echo $line | cut -d '|' -f 3 | cut -d '(' -f 2 | cut -d ')' -f 1`
time=`echo $line | cut -d '|' -f 3 | cut -d ' ' -f 3,4`
pub_date="$day $time"
lines=`echo $line | cut -d '|' -f 4 | tr -d ' lines'`
read line
printf "- \n" >> $RSS
printf "\n" >> $RSS
printf "
$author \n" >> $RSS
printf "
$pub_date \n" >> $RSS
printf "" >> $RSS
while read line; do
printf "$line\n" >> $RSS
lines=$(( $lines - 1 ))
if [ $lines -eq 0 ]; then
break
fi
done
printf " \n" >> $RSS
printf " \n" >> $RSS
read line
done
printf " \n" >> $RSS
printf " \n" >> $RSS
I decided to create a repository to collect these svn-hacks: track them under the name svn-tools.
Suppose you have a led-matrix and you want to control it via RS232.
Suppose that the microcontroller between the matrix and the pc is able to receive informations regarding how to light up the leds of the current column.
Imagine that you need a driver that take as input a file containing “well-formatted” text, and write to the serial port the informations for the microcontroller.
Imagine that you need a gui which let you create formatted files to send to the driver above.
Stop imagine, it is real!
Try the gui here.
Follow the public repository under the name: led-matrix.
Inspired by the script of the rotating cube, i decided to go on with the work. The result? Well, i added face filling, and some 3d effects such as face-culling and color shading depending on the distance/orientation of the light. At the moment it’s written using python + gtk, but my intention is to port it on a programming language such as c.
You can access the sources from the repository; the name of the project is 3dscene, and remember: the trunk section contains the files for the c-port, instead if you want to play with the python version of the code, then you have to browse the tags/1.0 directory from the repo.
Switch_host is a tool that let you handle and configure a hostname lookup. Configuring the makefile, you tell switch_host what is the IP address to work with.
Switch_host is useful when you have a local server, and you want to use it either when you are at home or when you are out. Instead of modifing /etc/hosts by hand, switch_host will do it for you.
Usage: switch_host [options] Options: -a | --actual Show current setting -d | --dynamic Set dynamic host -h | --help Print this message -s | --static Set static host
Check out the README file for any helps.
Follow the project in the repository under the name: switch_host.
Running dwm, i needed a piece of code for the management of fn-keys. So i ended with a client/daemon application capable of doing stuff such as disabling wifi, toggle the lvds backlight, increase/decrease volume ecc ecc. The communication method is always the same: a shared fifo placed in /tmp.
Because of the need of running commands with root privileges, i added a small c launcher (hotkeys_launcher), which makes use of the ’s’ bit for invoking the daemon as super-user.
In order to use the scripts you need these programs: xrandr, amixer, xbacklight, system_info (previous post), osdc/osdd (previous post), hibernate, hibernate-ram.
Just for taste, here is the help message displayed with the client-side app:
usage: hotkeysc [option] option: B+ increase brightness B- decrease brightness Bt turn off/on brightness G change cpu governor H hybernate h print this message I displays general informations (cpu-load, temperature..) M switch to external monitor R restart the daemon S suspend Td disable trackpad Te enable trackpad V+ increase volume level V- decrease volume level Wt enable/disable wifi interface
Before using the launcher inside your .xinitrc file, try the daemon in a shell in order to debug errors due to programs not found ecc ecc.
Here is my .xbindkeysrc file configured for hotkeysc/d:
# Brightness Up "hotkeysc B+" m:0x0 + c:233 XF86MonBrightnessUp # Brightness Down "hotkeysc B-" m:0x0 + c:232 XF86MonBrightnessDown # Brightness Toggle "hotkeysc Bt" m:0x0 + c:156 XF86Launch1 # Governor (xbindkey "hotkeysc G") m:0x0 + c:210 XF86Launch3 # Info (xbindkey "hotkeysc I") m:0x0 + c:244 NoSymbol # Monitor switch (xbindkey "hotkeysc M") m:0x0 + c:235 XF86Display #-------------------------------------------------- # # Suspend # (xbindkey "hotkeysc S") # m:0x0 + c:223 #-------------------------------------------------- # Trackpad toggle xbindkey "hotkeysc Tt") m:0x0 + c:200 NoSymbol # Volume Up "hotkeysc V+" m:0x0 + c:123 XF86AudioRaiseVolume # Volume Down "hotkeysc V-" m:0x0 + c:122 XF86AudioLowerVolume # Volume Toggle "hotkeysc Vt" m:0x0 + c:121 XF86AudioMute # Wifi toggle (xbindkey "hotkeysc Wt") m:0x0 + c:246 NoSymbol
You can grab the source from the repository under the project name hotkeysd.
While working with minimal windows manager (awesome, dwm), i created a simple client/daemon system useful for showing text on screen; i used it for temperature, cpu-usage, battery life remaining and stuff like that.
The communication system is based on a fifo placed by default in /tmp directory.
The daemon (osdd) could be invoked with some options that let you configure the appeal of the window.
The client is invoked considering that each argument will be printed on screen as a new line, i mean:
$ osdc "first line" "second line" foo3 foo4
has as effect an osd message composed by 4 lines.
You can get the sources from the repository: project name osdd.
I often had come into the need of knowing informations from the running system (i.e. cpu load, memory usage or temperature).
One for all, i wrote down a script that collects few fuctions for grabbing these infos from the linux proc/sys file-system.
Remember to edit the script before the installation, in order to match your needs.
Usage: /usr/bin/system_info [-bdhlmnt]
-b prints battery info
-d prints date
-h prints this help
-l prints system load
-m prints memory usage
-n prints network stats
-t prints temperature
Take it from the svn repository: the project name is system_info.
GCalendar is a small port to python+gtk of the old XCalendar tool.It’s a simple interactive calendar program with notebook capability.
The directory used for the stored annotations is ~/Calendar.
You can take the sources from the repository. Project name: gcalendar
Alan is a tool which displays the playback of “default” alsa audio device; it can be used also as a dynamic spectrum analyzer.
In order to build alan you need alsa and gtk development libraries.
You can grab the source from the repo: the project name is alan.