Archive

Archive for April, 2011

Update code with GIT or SVN

April 29th, 2011 No comments

To update your source code and recompile SVN:

cd {dir_with_source}
svn up
make clean

http://blog.avirtualhome.com/2009/05/29/how-to-compile-mplayer-with-vdpau-support-on-ubuntu/

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
make
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 Tags:

Redirect all but one IP in PHP

April 28th, 2011 No comments

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

<?php
  if ( $_SERVER["REMOTE_ADDR"] != "192.0.0.0" ) {
      header("Location: http://otherurl.example.com");
      exit(0);
  }
?>

Or use mod_rewrite in Apache:

RewriteCond %{REMOTE_ADDR} !^1.2.3.4$
RewriteRule /?(.*)$ http://my.redirect.com/$1
Categories: Programmering Tags:

Synergy to control keyboard and mouse

April 14th, 2011 No comments

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.

Ref: http://synergy-foss.org/

Categories: Bash, Linux, Ubuntu, Windows Tags:

Tweak Ubuntu desktop

April 7th, 2011 No comments

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 Tags:

Create folder thumbnails in Ubuntu

April 5th, 2011 No comments

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.

Ref: http://software.flogisoft.com/cover-thumbnailer/en/

Categories: Linux, Ubuntu Tags: