Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

This website unfortunately got a larger number of dead links when it was restructured. Seach engines don't like this. That's why I wrote a go program which helped me to locate the pages with dead links and also creates a sitemap.

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

I just stumbled upon a nice way to enhance the bash debug trace output format (See here for the source).

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

A lot of time you have to split a string into pieces. There exist various ways to get it done. For example you can use sed or grep with a regular experssion. But there are much more efiicient ways available by using plain bash:

Question: How to extract the first and second path from the given string s="someString:/path1/path2/path3/path3/test.bin"

Solution: /path1/path2

Use cut:

echo $(cut -f 2-3 -d / <<< "$s")

Use sed:

echo $(sed -r 's/[^:]+:((\/[^/]+){2})(.*)/\1/' <<< "$s")

Use plain bash and read:

IFS=/ read x a b y <<< "$s"; echo "/$a/$b"

Use plain bash and set:

IFS=/ eval set -- \$s; echo "/$2/$3"
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

I just faced an issue when I tried to start a bash script which actually updates itself if there is a newer script version available and then calls itself again - but now the updated version with the same invocation parameters. This script update should happen transparently for the script user so all the time the script is invoked the latest script version is used.

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

I manage my code on a local git repository on my desktop. But I want to access the git repository also from my local laptop or via VPN from remote. This requirement needs to convert the local repository into a remote repository. I'm running a Raspberry as my LAN server which is online all the day and is a perfect git server.

There are a lot of articles in the net how to achieve this. Finally I managed to find my way to get it done. It's not difficult but you have to know what you have to do.

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

It's very useful if your Raspberry can trigger events based on time and sunset and sunrise. That's why I did some investigations on this and finaly found two APIs in the internet which allowed me to write a Python script to calculate these values very fast. gneadr found another interesting variant which I modified a bit.

 

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
From time to time people ask in foren how to extract the network utilization values of fritz 7390. Some time ago I found a page of AVM where they described in detail the algorithm how to authorize with java (The description is in German but the Java code is self explanatory).
 
I used the java program code to create a prototype in python. This way you can read also other webpages of fritzbox. Use and extend the code if you want. There also exists a bash prototype with curl. If you use go just visit this page.
 
For another nice source of information about hard- and software about AVM and Fritzbox see Hemmerling: FRITZ!Box.
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

I just stumbled upon a very nice and detailed article, which explains bash redirections very detailed. When you finish reading the article you know everything about redirections. This article is one of a sequence of five 'bash one-liners' articles - Working with files, working with strings, working with history and navigating around, which are also very interesting and helpful.

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
Python allows to bundle a lot of Python files with py2exe in one executable for Windows. That way a simple call of this exe allows to start the Python program. No installation is required. I don't like windows and use Linux instead. That's why I had to search for a similar solution on Linux. I just want to have all my Python code bundled in one shell script and to be able to distribute one bash file only instead of the whole set of python files.
 
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
This sample code scrambles words in text and you still can read the text. Amazing.
Rules:
1) Don't scramble a word with less than 4 characters
2) Keep the first and last character of the word and scramble the rest   
 
Invoke cgi script => Scramble words (Doesn't work any more because my new provider doesn't offer cgi). As an alternatice you can call the Implementation in Javascript).
Script as pure Python script  => Download
 
The same algorithm I implemented on this page together with the source code in Javascript.
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
On this page a Python script is referenced which discovers available WLANs and finds the optimal channel to use for your WLAN. You can download it here .
 
Other tools to get information about WLANs:
inssid
 
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
Wie lernt man eine Progammiersprache? Indem man sich in die Syntax und Semantik einliest und parallel dazu auch gleich kleine Beispiele in dieser neuen Programmiersprache schreibt.
How do you learn a new programming language the most efficient way? Read about the syntax and semantik and write in parallel small programs in the new language. I wrote the following small Javascript program for this purpose. It scrambles characters of words according some rules. The interesting point is, that you still can read the text. I implemented the same logic here with Python and CGI. You also will find there additional backgroundinfo about the used algorithm. It's written to support German and English. If the browser language is German all Text will be in German. All other visitors will get the text in English.
 
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
I learn Python right now and publish here all links I find helpful to get on speed with Python.