This is a really annoying problem we meet pretty often. You can meet it even if you don’t use Bash. For example, you upload an image named “my lovely cat.jpg” to your website and find no image there. Or it has no thumbnail. This may happen because you are using some program for making thumbnails that is being called from, say, PHP via backtick operator (that is, using unix shell) and that program interprets the file name passed to it as three different command line options: my, lovely and cat.jpg.
I was doing a simple test of pwgen (handy utility to generate passwords) and since this test was creating a lot of files in a folder I decided to combine it with a test of ls speed vs find speed:
For some reason there is no obvious way to enable it (Gnome 2.26.3)
- Open GConf editor: Applications -> System Tools -> Configuration Editor
- apps -> metacity -> general -> compositing manager (check box there)
That’s all. Enjoy numerous visual effects like shadows, real transparency (underlying windows become visible) etc.
If you (like me) use mplayer to play music, you might want to make it possible to play songs in random order. Here is a simple script for this:
#!/bin/bash
tempfile=/tmp/randplay-$$
touch $tempfile
trap 'rm -f $tempfile; exit' 0
trap 'rm -f $tempfile; exit' 3
trap 'rm -f $tempfile; exit' 15
songsdir="${1}"
# Remove the finding playlist condition below if you want the list of files to be regenerated each time
# you run the script. This is useful if the content is changing often, but delays the script startup.
# You can also simply remove file m.playlist from the folder if its content changes.
if [ -f "${songsdir}/m.playlist" ]
then
echo "Playlist found!"
else
n=1
OFS=$IFS
IFS='
'
for song in `ls "${songsdir}"`
do
echo "$n ${song}" >> "${songsdir}/m.playlist"
n=`expr $n + 1`
done
IFS=$OFS
fi
songstotal=`cat "${songsdir}/m.playlist" | wc -l`
while true
do
echo ">>> `cat ${tempfile}|wc -l`"
sleep 1
a=$RANDOM
songsnumber=`expr $a - $a / $songstotal \* $songstotal`
[ `cat ${tempfile} | grep -c ^${songsnumber}$` -gt 0 ] && echo "Skipping `grep "^$songsnumber" "${songsdir}/m.playlist" | sed "s|^$songsnumber ||"`" && continue
echo ${songsnumber} >> ${tempfile}
songname=`grep "^$songsnumber" "${songsdir}/m.playlist" | sed "s|^$songsnumber ||"`
mplayer -quiet "${songsdir}/${songname}"
[ $? -ne 0 ] && exit 0
done
The syntax is simple:
<script name> <folder>Use ESC-ESC or PgUp to skip, Ctrl-C to stop.
There is the command eval available, that does the trick:
To make possible managing your system clock on Xen VPS server:
sysctl -w xen.independent_wallclock=1 |
or:
echo 1 > /proc/sys/xen/independent_wallclock |
Vi commands reference, excerpted from the documentation. I’ve been using vi for years, but it’s still a very exciting reading for me (kind of “wow! It’s just that simple!”)
[fglrx:firegl_init_module] ERROR firegl_stub_register failed
Looks awful, but it’s simple. It means one of the following:
- Another module is already loaded (e.g. radeon.ko)
- Module drm.ko is loaded (it always is, if 1)
- Under some circumstances CONFIG_AGP=y interferes with AGP support compiled in fglrx (should be more detailed description here)
Home
Contacts
Downloads
RoR
Servers
Notes
Linux
ERR
Русский