For a small slide show I wanted to randomize the filenames. I first thought about random numbers but I realized that there can be collisions. Then I came over the idea to use a hashing algorithm. The first few characters should be sufficient (like in git).
Here is a short snippet. It’s quick and dirty but it works. Maybe it would be nice to specify file extensions, too.
for f in *.png
mv $f$(echo$f | md5sum | cut -b1-10).png
At home i have an external monitor connected via HDMI to my laptop. Before disconnecting you have to disable the output, or KDE will go crazy and display windows out ouf the visible desktop.
I don’t like the mouse intensive way of going to the menu, start the settings and click to the display configuration.
There is a simpler way to configure the display from the commandline with xrandr. I just created two scripts, one to enable the HDMI output and set it right of the LVDS output, and one to disable the HDMI output.
git clone https://github.com/esden/summon-arm-toolchain.git
# it failed downloading newlib-1.19 so I did the following as workaround:cd sources
# needs long time, fix missing requirements (mostly -devel packages)#now clone stlinkcd ..
git clone https://github.com/texane/stlink.git
#environment setupexport PATH=$PATH:~/sat/bin
#now get sample programs from STcd ~/dev/st-blinky
#get Makefiles from jonathan thomson
cp STM32F4DISCOVERY_Makefiles/Makefile.IO_Toggle STM32F4-Discovery_FW_V1.1.0/Project/Peripheral_Examples/IO_Toggle
mv Makefile.IO_Toggle Makefile
#flash the program to the STM32
sudo ./st-flash write IO_Toggle.bin 0x8000000
In our current c++ program we used getopt for the argument processing. Compiling the program with Fedora16 was no problem. Today the code didn’t compile with Fedora17. The error was
thomas@thinky ~/FH/cs/3/cg/pr/3/Debug (git)-[master] % make
Building file: ../Cli.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Cli.d" -MT"Cli.d" -o "Cli.o""../Cli.cpp"
../Cli.cpp: In constructor ‘Cli::Cli(int, char**)’:
../Cli.cpp:7:42: error: ‘getopt’ was not declared in this scope
../Cli.cpp:20:7: error: ‘optind’ was not declared in this scope
../Cli.cpp:25:19: error: ‘optind’ was not declared in this scope
make: *** [Cli.o] Error 1
getopt is not in cstdlib anymore. The includes are extended with getopt.
AirDroid is a Android app which provides a webinterface to your Android device. The webinterface is accessed through the local WiFi.
The most useful feature for me is to write Textmessages (SMS) from your Laptop. Another nice feature is to make screenshots and download it directly with the browser. The interface is very well designed and the app is for free.
This time I am sharing a simple design for a H-Bridge with used parts and an mbed ARM Cortex-M0 controller.
I had a bit difficulties to control the PNP transistors with the controller. The deal was to lift the voltage for the base of the PNP.
My design is based on used parts out of old cheap 5.1 dvd / audio combination and other stuff. Basically I think it doesn’t really matter which type of transistor you use unless you are dealing with high powered motors.
Not so much text, here is the schematic:
Here a picture of the breadboard prototype:
To control the motor with the mbed you can write a program based on the following source:
You know this situation you started eclipse in a terminal and after opening a few files you want to type some commands in the terminal but you forgot the & after the command.
You can kill the programm (eclipse) with strg+c or you can pause it with strg+z and send it to the background with the bg command. After that your programm is continuing normal and you can use the terminal.
Using gPhoto and libgphoto2 you can control your Camera with your Linux PC and the Commandline. I’m using fedora16 and a Nikon D5000. With this setup you can easily shoot and download pictures using the USB cable. It is used as control and after the capture downloads the picture to your local folder.
To install gphoto2 on fedora use following command:
sudo yum install gphoto2
Connect your Camera to your PC or Laptop. Run following command to capture and download a Image:
Sometimes I shoot my pictures with Nikons NEF/RAW format but keep also shooting JPEGs. To sort bad pictures out I only view the JPG and delete them if I don’t like them. After this process I end up with sometimes very much NEF/RAW images which I don’t want.
To delete the unwanted NEF/RAW files you could probably just find them in the file explorer and delete them.
If you are at a Linux Box, there are better ways to do this. If also using the zsh, you can use this simple command to print all NEF files where no JPG exist:
print *.NEF(e_'[[ ! -e $REPLY:r.JPG ]]'_)
or just delete them:
rm *.NEF(e_'[[ ! -e $REPLY:r.JPG ]]'_)
Command based on http://grml.org/zsh/zsh-lovers.html
# Show me all the .c files for which there doesn't exist a .o file.
$ print *.c(e_'[[ ! -e $REPLY:r.o ]]'_)