Arkiv för april, 2011

Update code with GIT or SVN

april 29th, 2011 Inga kommentarer

To update your source code and recompile SVN:

cd {dir_with_source}
svn up
make clean

Example to compile ffmpeg after source update:

./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc \
    --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
    --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis \
    --enable-libx264 --enable-libxvid --enable-x11grab
sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no \
    --deldoc=yes --fstrans=no --default
hash x264 ffmpeg ffplay ffprobe

To compile MPlayer you might need some extra directories from ffmpeg. Example:

cd ~/code/mplayer
mkdir libavutil
cp -r /home/holm/code/ffmpeg/libavutil/* libavutil

To update your source code and recompile GIT:

cd {dir_with_source}
make distclean
git pull
Categories: Programmering Taggar:

Redirect all but one IP in PHP

april 28th, 2011 Inga kommentarer

Example if you’d like to redirect all web visitors except one IP:

  if ( $_SERVER["REMOTE_ADDR"] != "" ) {

Or use mod_rewrite in Apache:

RewriteCond %{REMOTE_ADDR} !^$
RewriteRule /?(.*)$$1
Categories: Programmering Taggar:

Synergy to control keyboard and mouse

april 14th, 2011 Inga kommentarer

Synergy is a very good program for sharing mouse and keyboard. It’s free and open source too! There are compiled versions for Windows / Linux and Mac.

Set up one computer as server and then control the mouse and keyboard on several others through the network.
To autostart the client on an Ubuntu after login, add a startup program and run the following script:
sh -c 'ps -A|grep -w synergyc; if [ $? -eq 0 ]; then echo KILLING; \
/usr/bin/killall -9 synergyc; fi; /usr/bin/synergyc YOURSERVERIP
You have to log in to the Ubuntu desktop first before you can control it from another computer. You can start the Synergy client before logon, but it’s a bit harder. In Ubuntu 10.10 with Gnome you can edit the following files to start the Synergy client before logon:
sudo gedit /etc/gdm/Init/Default
sudo gedit /etc/gdm/PostLogin/Default
Put the Synergy start script above in the first file (without the sh -c and quotation marks) and put just the kill code in the second file. See the Synergy home page for more info.


Categories: Bash, Linux, Ubuntu, Windows Taggar:

Tweak Ubuntu desktop

april 7th, 2011 Inga kommentarer

Some tips for tweaking the Ubuntu 10.10 desktop:

Install dockbarx

sudo add-apt-repository ppa:dockbar-main/ppa && sudo apt-get update && \
sudo apt-get install dockbarx && sudo killall gnome-panel

Then right click a Gnome panel, select ”Add to panel” and add DockBarX.

Compiz desktop

Enable the screenshot feature. Click ”Super”+Left mousebutton to get a screenshot.

Categories: Linux, Ubuntu Taggar:

Create folder thumbnails in Ubuntu

april 5th, 2011 Inga kommentarer

Cover thumbnailer is a small Python script which displays music album covers in nautilus, preview of pictures which are in a folder and more.

The script fits in nautilus like any other thumbnailer of the GNOME thumbnail factory; so you don’t have to run it manually to generate thumbnails.

Cover thumbnailer is free software under GNU GPL v3+ license, you are free to modify and redistribute it under the terms of the license.


Categories: Linux, Ubuntu Taggar: