Adding http:// back to the URL bar in Firefox
ghacks.net has an excellent article on how to do this. I archived it here.
Parse long options in bash scripts
geirha in #bash on irc.freenode.net had this solution, which I rather liked and wanted to keep for later use:
Creating .deb-Packages With Checkinstall
If you've exhausted all other options, it might be time to compile from source, even in Debian.
If you're about to do that though, don't abandon the concept of .deb files and the advantages they bring with versioning and easy removal. Use "checkinstall".
Checkinstall is in the standard Debian repositories and encapsulates your install into a nice, easily installable and distributable .deb file. apt-getting it and reading the manual is easy enough, but if you want a howto, falkotimme.com has a nice one, archived here as a PDF.
UDP through SSH
http://zarb.org/~gc/html/udp-in-ssh-tunneling.html
Good. Archived for personal reference.
SSH in a while loop – stdin problems
When SSH is used with a line like "while read ....", the while loop will only run once.
This can be seen by running this simple example:
$ seq 1 10 | while read line; do ssh remotehostname "echo x${line}x"; done
x1x
You might expect this to connect to the host with the name "remotehostname" 10 times, and each time print one of the numbers in the sequence from 1 to 10. This will, however, not be the case. The result is a single line, saying "1".
Where did the rest of the numbers go? To the SSH process.
By default, SSH runs off with the stdin file descriptor, preventing "read" from reading anything else from it. You can see this by trying the following example:
$ seq 1 10 | while read line; do ssh remotehostname "echo x${line}x; cat -"; done
x1x
2
3
4
5
6
7
8
9
10
Now all the numbers were printed, but they were all in a single ssh connection. As you can see, only the number "1" got the X'es on both sides, indicating it was printed by the "echo" instruction. The rest of the numbers come from "cat -", which basically takes whatever comes in on SSH's stdin, and dumps it to the stdout (the screen, in this case). So that's where they went!
Now, how do you remedy this?
Answer: SSH's -n switch. From the manual:
-n Redirects stdin from /dev/null (actually, prevents reading from stdin). This must be used when ssh is run in the background. A common trick is to use this to run X11 programs on a remote machine. For example, ssh -n shadows.cs.hut.fi emacs & will start an emacs on shadows.cs.hut.fi, and the X11 connection will be automatically forwarded over an encrypted channel. The ssh program will be put in the background. (This does not work if ssh needs to ask for a password or passphrase; see also the -f option.)
So let's try that with -n, shall we?
$ seq 1 10 | while read line; do ssh -n remotehostname "echo x${line}x; cat -"; done
x1x
x2x
x3x
x4x
x5x
x6x
x7x
x8x
x9x
x10x
There. 10 SSH connections opened, 1 number printed each time. A total waste of time, but a rather simple example to follow
Set php.ini values using .htaccess
Did you know that you can set php.ini values right inside the .htaccess file?
You can do so by adding lines like these:
#format
php_value setting_name setting_value
#example
php_value upload_max_filesize 128M
GCC stray X in program
Problem:
IEMGD_HEAD_Linux/common/drm/emgd/display/pi/cmn/pi.c:1: error: stray ‘\357’ in program
This is caused by "invalid" characters in the code, specifically I encountered this while trying to compile the Intel EMGD driver for my EEEPC's graphics card.
Thanks to the helpful folks over here, there's a solution:
cd IEMGD_HEAD_Linux/common/drm/emgd/display/pi/cmn
cat -v pi.c | awk '{if(NR>1) print $0}' > tmp # make strange characters on first visible and remove
mv tmp pi.c
That makes the invalid characters visible and removes them.
In this case, it leaves some partial, garbage comments behind, so the file still wont compile.
To resolve this, I opened the file in vim, and quickly searched for and removed the faulty comments (and some I didn't have to remove).
Remember to answer "no" to the question of re-extracting the tarball each time you retry building this.
Attached is the original driver file, and my modified copy of pi.c
Result:
"Completed EMGD Installation"
Tell your friends how to burn ISO files properly
I have no idea how many blank CD's I've seen wasted on having a file system with a single .iso file on them. Then, I found this page: http://iso.snoekonline.com/iso.htm
It tells you how to burn an image with basically any Windows-based software out there. If someone runs Linux, I assume they can figure it out for themselves.
Archived for my convenience right here.
xorg.conf for KVM
Found this somewhere.
Works for me.
Section "ServerLayout"
Identifier "BodhiZazen's KVM xorg.conf"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Module"
Load "record"
Load "dri"
Load "extmod"
Load "glx"
Load "dbe"
Load "dri2"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "vmmouse"
Option "Protocol" "SysMouse"
Option "Device" "/dev/sysmouse"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
HorizSync 20.0 - 50.0
VertRefresh 40.0 - 80.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Card0"
Driver "vesa"
VendorName "KVM - std"
BoardName "GD 5446"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Modes "800x600"
EndSubSection
EndSection
Debian APT Pinning properly explained
Accidentally stumbled across the "Debian Cheat Sheet" at http://carlo17.home.xs4all.nl/howto/debian.html
Finally some documentation on why the heck pinning with "Package: *" and "Package: mypackage" doesn't mix well, and other useful knowledge.
In case the link goes dead, here's a PDF: debian_cheat_sheet.pdf