
Shelr.tv allows Unix/Linux command line users to record something interesting from their terminal and share it to followers.
It is a bit like YouTube for plain text shellcasts. A great feature is that you can copy and paste everything you see.
A nice intro with interesting comments from one of the core developers can be found on linuxaria.com.
A Debian package has been proposed through the Debian “package mentor” system.
Prerequisites:
- Install the gphotofs and exif packages.
- Make sure you have the folders $HOME/devices/camera (camera mount point) and $HOME/media/photos (base folder for photo folders) or edit the script below to use different locations.
- Verify that your camera mounts fine using gphotofs and that it internally stores JPGs in a subfolder of “DCIM”.
Save this script as /usr/local/bin/copy-cam-jpgs.sh:
#! /bin/sh
mountpoint=$HOME/devices/camera
targetfolder=$HOME/media/photos
# check availability of cmdline tools
type gphotofs exif fusermount || exit
# mount camera if necessary
if ! mount|grep "$mountpoint"; then
gphotofs "$mountpoint"
fi
cd $mountpoint/*/DCIM/*
for jpg in *.JPG; do
year_month=$(exif --tag=0x9003 -m $jpg \
| cut -f1,2 -d: \
| tr ':' '/')
folder="$targetfolder/$year_month"
mkdir -p "$folder"
mv -v "$jpg" "$folder"
done
cd
fusermount -u $mountpoint
Make it executable like this:
chmod ugo+x /usr/local/bin/copy-cam-jpgs.sh
Then plug in your digital photo camera and run “copy-cam-jpgs.sh“. It will move all JPGs from the camera to $target_folder/yyyy/mm where yyyy is the 4 digit year and mm is the two digit month of the date the photo was taken (as per EXIF data in the JPG).
Sometimes the XFCE desktop icons get messed up, for example by games that temporarily change the screen resolution to 800×600.
A solution to this problem has been mentioned here. It suggests using “sudo chattr +i” to lock the config file where XFCE stores the icon positions.
Alternatively (and without the repeated need for sudo and chattr) you can also backup and restore the ~/.config/xfce4/desktop/icons* file(s) like this:
Create a script /usr/local/bin/save-xfce-desktop-icons.sh like this:
#! /bin/sh
mkdir -p ~/.config/xfce4/desktop.bak
cp -f ~/.config/xfce4/desktop/icons* ~/.config/xfce4/desktop.bak
Create another script /usr/local/bin/load-xfce-desktop-icons.sh like this:
#! /bin/sh
cp -f ~/.config/xfce4/desktop.bak/icons* ~/.config/xfce4/desktop
Make the scripts executable like this
sudo chmod ugo+x /usr/local/bin/save-xfce-desktop-icons.sh
sudo chmod ugo+x /usr/local/bin/load-xfce-desktop-icons.sh
Then in the XFCE start menu, go to “Settings” – “Keyboard” – “Application Shortcuts” and configure 2 keyboard shortcuts:
| Command |
Shortcut |
| save-xfce-desktop-icons.sh |
<Control><ALT>S |
| load-xfce-desktop-icons.sh |
<Control><ALT>L |
Then you will be able to backup and restore your icons like this:
- Backup: Press F5 then <Control><ALT>S then F5
- Restore: Press F5 then <Control><ALT>L then F5
The F5 is necessary to synchronize what you see on the screen with the content of ~/.config/xfce4/desktop/icons*.
bash script to recursively sanitize folder and file names:
#! /bin/bash
shopt -s extglob;
find $1 -depth -print | while read path
do
filename=$(basename "$path")
directory=$(dirname "$path")
filename_clean="${filename//+([^[:alnum:]_-\.])/_}"
if (test "$filename" != "$filename_clean")
then
mv -v "$directory/$filename" "$directory/$filename_clean"
fi
done
I listen to web radio stations but I don’t want to use any player ui for that. All I want is:
- Select a station from a list of my favorites and listen to it
- Be able to stop current web-radio playback
- Never have more than one station playing at the same time
I do it like this:
- For each radio station save a playlist file (*.pls, *.m3u or sometimes *.asx) in a folder called “radio” on my local machine. I download most of them from the shoutcast or icecast stream directories. I also add one special (empty) file called “none.pls” (which serves to turn of all radio).
- Add a toolbar to the taskbar that lists the content of the radio folder, i..e. all the webradio playlist files as clickable items. In XFCE this requires a Gnome applet (Debian packages xfce4-xfapplet-plugin, file-browser-applet).
- Configure the default app for the playlist mime types mentioned above to be my bash script “mplayer-radio.sh”. It kills any existing webradio playback and plays the selected playlist file. See below for how to configure mime-type association defaults.
- Make sure that I have a “nogui” version of mplayer installed so that no window pops up. Don’t use gmplayer, kplayer or any of that crap to play audio. I like mplayer because it supports all codecs out of the box.
This is my little “mplayer-radio.sh” script (requires the pkill command):
#! /bin/bash
pkill -f "mplayer -playlist"
mplayer -playlist "$@"
To set my script as the default handler for the most common playlist file types, put the following into ~/.local/share/applications/defaults.list:
[Default Applications]
audio/x-mpegurl=mplayer-radio.sh.desktop
audio/x-scpls=mplayer-radio.sh.desktop
Make sure you have a file “mplayer-radio.sh.desktop” in ~/.local/share/applications or in /usr/local/share/applications with contents like this:
[Desktop Entry]
Exec=mplayer-radio.sh %U
MimeType=audio/x-mpegurl;audio/x-scpls;video/x-ms-asf
Name=mplayer-radio.sh
StartupNotify=false
Terminal=false
Type=Application
If I have to use M$ Windows then I do something similar using a taskbar toolbar for the radio folder and the lightweight Foobar2000 player, configured to run minimized as systray icon.
This is for a 64bit system:
Download Oracle’s JDK7 RPM package for 64bit Linux. The filename should be “jdk-7-linux-x64.rpm”.
Then as root:
zypper install jdk-7-linux-x64.rpm
cd /usr/java/jdk1.7.0/bin
for bin in *; do update-alternatives --install /usr/bin/$bin $bin $(pwd)/$bin 20000; done