Archive for the ‘Linux’ Category
June 10, 2008
My current hosting provider, hosting365, is a traditional-style hosting service, where file upload is still done via FTP with passwords sent as clear text. They provide ssh access on demand, and it has to be manually approved by company’s staff. I don’t understand why don’t they provide shell by default. Maybe it’s part of being a traditional style hosting and trying to avoid the word “shell” or anything like it.
Shell they provide, but what about public key authentication? No, they don’t. As this is turned on by default in all Linux installations, they must have switched this option off. Why did they do that, remains a mystery as public key authentication is no less secure than password entry.
(more…)
Tags:automation, hosting365, passwords, pexpect, Python, scp, security, ssh
Posted in Linux, Python | No Comments »
June 3, 2008
Continuing my series of short tech notes for future generations.
The problem: ctrl key not working in VNC session. xev command doesn’t show any events coming after pressing ctrl key.
Cause: You’re using Gnome, aren’t you? Gnome has a feature that allows to locate the pointer: if you press and release ctrl key, it will show a small animation around your pointer. Unfortunately, it interferes with vncviewer.
Solution: Few websites, including BBC, offer a fix: System → Preferences → Mouse → Cursors tab…
Problem with the solution: Oh noes! Cursor tab is not there! I can’t change the setting!
Solution to the problem with the solution: Use gconf-editor to change the setting: Applications → System Tools → Configuration Editor. Press CTRL+F. Type: “pointer”. Tick “search also in key names” and press “Find”. Click /desktop/gnome/peripherals/mouse/locate_pointer. Untick the checkbox next to it, on the top right pane.
Tags:ctrl, gnome, Linux, vnc
Posted in Linux | 1 Comment »
March 16, 2008
Here’s an ebuild for Python mocker. Really cool mock module, which doesn’t come up high on Google.
Tags:linux gentoo ebuild
Posted in Gentoo, Linux, Python | No Comments »
March 9, 2008
I don’t study any more since December 2006. I’ve completed my Masters, and… the game seemed to be over. But when a friend has recommended TTC courses to me, I started listening to them… and become addicted. I’ve completed Philosophy of Religion by James Hall, Great Ideas of Psychology by Daniel N. Robinson and Explaining Social Deviance by Paul Root Wolpe. I’m currently listening to Argumentation: The Study of Effective Reasoning by David Zarefsky. I have a few more courses to go through, so I won’t be out of lectures anytime soon.
However, it turned out that watching them as videos doesn’t work well for me. When I’m at home, I have plenty of other things I’d like to do. But they work well in audio, as I can listen to them when commuting. I’m going to buy new courses in audio, but what about those ones I have already in DVD? Can I convert them into audio?
I’ve put together a shell script, which dumps all tracks from DVD and encodes them into mp3 format. It also normalizes volume, so the voice of the speaker has more or less constant volume, which is good when listening in noisy environment.
It was written on Linux, if you’re a Windows user, you can try running it under Cygwin.
Posted in Computers, Linux | No Comments »
February 8, 2008
USB devices like pendrives and external drives stopped mounting. I couldn’t work out what was the problem. dmesg showed that the USB device was recognized. Gnome volume manager was started. Hal and dbus also working. And my drives just wouldn’t mount automatically.
I’ve finally found a solution on forums.gentoo.org. The problem was that gparted, which I happened to install a while ago, put this file into hal’s configuration:
/usr/share/hal/fdi/policy/gparted-disable-automount.fdi
I found the „true” part in the file, changed it into „false”, restarted hal, and voila, my drives are being mounted now!
Why was the file put in that place? The story is, gparted puts it there on start so usb devices don’t get in its way. It removes this file on exit. On graceful exit, that is. If it’s killed, it doesn’t remove it and the file just stays there.
Posted in Gentoo, Linux | No Comments »
February 8, 2008
I bet you guys have a hard time figuring out how it works with woo-woos. Here you have it black on white. If a woo-woo would be a sysadmin, they would do more or less:
$ dd if=/dev/urandom of=i-believe bs=1 count=$RANDOM
18676+0 records in
18676+0 records out
18676 bytes (19 kB) copied, 0.172968 s, 108 kB/s
$ chmod 755 i-believe
$ ./i-believe
And voila! All the work is done!
Posted in Humor, Linux, Rationalism | No Comments »
January 30, 2008
Resuming my tech-notes blogging…
I’ve recently bought three Studio Ghibli’s movies. I don’t have a TV-set (yes, lenina, I’m still not watching any TV), so I’m watching DVDs on my laptop. DVDs I got are interlaced, when watching them on a computer, you can see small horizontal stripes along the sides of moving objects.
On a TV-set, this is not a problem, actually, interlacing makes animation on TV-set smoother. But on a computer, all you get from interlacing is stripes.
MPlayer comes with few deinterlacing plugins, from which yadif and kerndeint seem to work best (but I’m open to other suggestions). However, my video output is GL:
maciej@clover ~ $ cat .mplayer/config
vo = gl
autosync = 20
monitorpixelaspect = 1
af = volnorm=2:0.6
ao = pulse
The problem with those deinterlace filters is that they don’t cooperate with the gl video output. Fortunately, there’s an easy fix for that: append scale filter.
mplayer -vobsubid 1 -vf kerndeint,scale dvd://5
Replace 5 with your title number. The vobsubid option tells MPlayer to display subtitles. I like to watch Japanese movies with the original soundtrack and English subtitles. Usually, English dubbing reveals too much about the characters and lacks the original expression.
Tags:deinterlacing, dvd, interlacing, mplayer
Posted in Film, Free software, Linux, Software | No Comments »
November 26, 2007
I like to watch video on one laptop, while speakers are connected to the other; I don’t like the cable hanging in midair between the tables, begging to be pulled by someone when passing. I used to solve this by NAS, the Network Audio Server, an ancient, but still usable project that allows you to send audio through network and play from one computer to another. The problem is that I couldn’t lately get it to work. I’ve solved this yesterday, so here you go, back to the tradition of blogging my tech notes.
- problem: nasd (the NAS daemon) would interfere with other applications, or other applications with nasd
- symptoms: nasd won’t play, or Firefox won’t play, or music won’t play
- how to discover: applications complain about /dev/dsp being busy
- cause: nasd uses OSS, the deprecated “open sound system”, instead of ALSA, and OSS drivers often don’t allow applications to share sound output
- solution: make NAS (and other applications, too) use alsa by using aoss wrapper
In Ubuntu:
sudo apt-get install alsa-oss
sudo gedit /usr/bin/start-nas
- Replace:
nice -n -10 /usr/bin/nasd -b "$@"
with:
nice -n -10 aoss /usr/bin/nasd -b "$@"
As for Firefox, follow these short instructions.
What happens now is, that the aoss wrapper hijacks calls to /dev/dsp made by NAS and handles them by using Alsa. The main interesting difference between OSS and ALSA is that in most OSS drivers, the sound output /dev/dsp cannot be shared among applications. For instance, having Firefox open might mean that Flash application is keeping the sound device open, even though it isn’t playing anything at the moment. And keeping /dev/dsp open means that no other application is allowed to play sound.
So far, I’ve watched one video using this setup, and the audio wasn’t perfect; I could hear clicks quite often. But I’m fine with that. If it annoys me, I’ll consider switching over to Pulse Audio.
UPDATE 2008-03-30:
I’ve switched to PulseAudio a couple weeks ago and I have to say it’s the best audio system I’ve ever used. The only strange thing I had to do was installing a library for Flash Player 9 that would make it able to use Pulse Audio. I have two computers transparently using a single set of speakers. Best setup ever.
Tags:alsa, aoss, audio, Howto, Linux, nasd, oss
Posted in Linux | No Comments »
July 4, 2007
If you ever shared code repository with people who use Windows, you might notice text files with set executable flag. Such files are a little annoying. When you do a directory listing you suddenly see a lot of programs. When you look at those programs, it turns out they are merely data text files or C++ source code. Since Windows doesn’t distinguish between executable and non-executable files in any other way than the *.exe extension, Windows guys are likely to commit such files unwittingly.
Here’s a line in shell that will help you. Give it a file name extension (say, *.txt) and it will find all the executables with that name and fix them.
find . -name '*.txt' -perm /u+x,g+x,o+x \
-exec chmod a-x {} \;
You can alter the *.txt part, specifying any extension you want. You might want to look for all the *.cpp, *.hpp, *.java, etc., files.
To find out if there are any other files that you might want to correct, try the following line. It will display all executable files:
find . -type f -perm /u+x,g+x,o+x
Subversion
If you use Subversion for your project, the above method will not work, because in Subversion, the executable flag is stored as a property. Here’s the same script that will deal with a local copy of code pulled from Subversion:
find . -name '*.txt' -perm /u+x,g+x,o+x \
-exec svn pd svn:executable {} \;
Posted in Linux | No Comments »
June 7, 2007
SCM stands for Source Code Management. Pretty much the same thing can be called VCS, Version Control Software. Perhaps even more TLA’s are there out in the wild. It all boils down to a program which allows programmers to manage their source code.
Pretty much everybody who started using SCM, started with CVS and then moved to something else. Probably Subversion, which is meant to be a CVS replacement. For more adventurous or demanding developers, there are many other SCM’s: Git, Bazaar, Monotone, Mercurial, Darcs… and more.
Mark Shuttleworth has written an interesting thing: that file and directory renaming is one of the most important operations to be handled with an SCM. I got curious and wrote a test case for three SCM’s I know: Bazaar, Git and Subversion. The scenario is:
(more…)
Posted in Computers, Linux, Programming | 8 Comments »