Count web server hits per IP address

If you have ever need to do a quick and ready count of hits per IP address from your server logs, then this is a handy one liner:

cut -d ' ' -f 1 logfile.log | sort -n | uniq -c

Where -d ' ' states that the fields are seperated by white space, -f 1 refers to the field containing the IP address in logfile.log

Create an encrypted tunnel to a proxy server

If you wish to encrypt the traffic from your machine to a web proxy, for example to secure your traffic as it passes through your ISP, the following is a good start:

ssh -fN -L localport:localhost:remoteport proxyserver

This uses ssh to connect localport on localhost to remoteport on proxyserver. Then all you need to do is set your browser proxy settings to use localhost as the proxy server, using port localport. For example, assuming you wish to use port 8080 on localhost to connect to a proxy server running on port 3128 on www.someproxyserver.com, the following should work:

ssh -fN -L 8080:localhost:3128 www.someproxyserver.com

This assumes you do have a user account on www.someproxyserver.com that grants you access to a ssh server!

xorg configuration

xorg configuration details can be found in the xorg.conf file and now in the xorg.xonf.d directory.

The xorg.conf file is processed before the files of snippets in xorg.conf.d and so takes priority.

An example. If you use the nvidia video driver, you will find that a file 20-nvidia.conf in xorg.conf.d, which contains some basic options, such as the option to disable the nvidia logo:

Section "Device"
        Identifier "Default nvidia Device"
        Driver "nvidia"
        Option "NoLogo" "True"
EndSection

If you wish to enable TwinView so your desktop spans two monitors, you can add a seperate Device section to xorg.conf including an Option "TwinView" "True" setting.

Section "Device"
        Identifier "Default nvidia Device"
        Driver "nvidia"
        Option "NoLogo" "True"
	Option "TwinView" "True"
EndSection

That way, when your distribution updates the files in xorg.conf.d your changes dont get over written. Simples.

Making chrome your default browser when not using a well known desktop environment

If you dont use one of the more well known desktops such as Gnome, KDE, XFCE etc, making chrome your default browser can prove tricky. In chrome's settings, you might see this messge:

"Chromium cannot determine or set the default browser"

Using the code below, you can trick chromium into thinking it is running in a Gnome session, which then enables the "Make Chromium my default browser" button:

GNOME_DESKTOP_SESSION_ID=1 chromium-browser

Run chromium using the above, make it your default browser, close it down and low and behold programs like Thunderbird will open links in chromium.

This does require some Gnome programs to be installed, in particular the gconf package.