Track CPU usage of a process with shell script

In order to track the CPU usage of a process I wrote that little script. Feed it with a PID and an output file and it generates some output you can easily use with TikZ/PGF in LaTeX.

You can adjust the step time by changing the $STEP variable.

Note: The time basis is not quite accurate since the calculations take their time which must be added to the actual step time.
However, in my use cases time accuracy was not primary important and thus could be ignored. I'm quite...  weiterlesen

Fritz!Box does not capture (RTP) traffic properly

From time to time I have to capture telephony traffic on a Fritz!Box Fon WLAN 7390.
Note: This is for research reasons only. Please do not capture calls without permission by the calling parties.

A very useful tool for capturing traffic is the built-in capture tool Fritz!Box Paketmitschnitt. You can access this via web browser: http://<your-fritzbox-IP>/html/capture.html

Unfortunately, the box happens to route some traffic past the capture. I faced this occasion...  weiterlesen

Raspbian wifi access with PEAP/MSCHAPv2

I wanted to connect to a wifi network secured with 802.1X (PEAP and MSCHAPv2) with the Raspberry Pi (Raspbian). However, it took me hours...

Here's what finally worked:
Assuming you use wpa_supplicant, edit or create /etc/wpa_supplicant/wpa_supplicant.conf. The essentials lie in lines 11 and 12. # /etc/wpa_supplicant/wpa_supplicant.conf network={ ssid="my_hotspot" proto=WPA2 key_mgmt=WPA-EAP pairwise=CCMP group=CCMP eap=...  weiterlesen

PHP auth against htaccess protection

I needed to authenticate against a .htaccess protected directory using PHP.
I needed it because I wanted to use LDAP login with PHP but couldn't access the LDAP server directly. I set up a protected directory using LDAP ressources on a web server and authenticated against it with this function.
To be frank, that is rather a workaround, but it was the only way to establish what I wanted to have.
<?php function httpauth($host,$authurl,$ssl = 0, $user, $pass){ if($ss...  weiterlesen

Dice control with GAL16V8

We used a GAL16V8 to build a digital dice.



Hereby, the GAL implements three components: clock control binary counter decoder for dice display
Clock control
To be able to use two different clock sources, we implemented a clock control with two buttons and a quartz oscillator (4.000 MHz).
Every time the grey button (STEP) is being pressed, a rising edge is given to the clock. Thus, you are able to manually switch through the states of the dice. When ho...  weiterlesen

Zufallszahlen in C

Ein Computer kann genaugenommen keine "echten" Zufallszahlen generieren.
Programmierter Zufall ist ausreichend für statistische Gleichverteilung aber nicht identisch mit natürlichem Zufall.
Programmiersprachen bedienen sich vordefinierter Konstanten, aus denen Zahlenfolgen berechnet werden. Hierbei entsteht die Problematik, dass sich nach einer Anzahl von Aufrufen die Zahlenfolge schlichtweg wiederholt.
Daher wird empfohlen, zum Beginn eines Programms die Funktion srand() mit der ...  weiterlesen

Convert wavelength in nm to RGB

Maybe some day you'll need to convert wavelengthes in nanometers to RGB values.
I just needed it for visualizing emission values of flourescent dyes in a lab information system.
I didn't want to make that by hand, picking e.g. 20 values from the color range to let them stand for everything between them, but wanted to have a proper and (at least approximately) exact solution.

The function below is based on an algorithm developed by Dan Bruton I found in the we...  weiterlesen
Buch Cover