Did the job nicely and found a good 40Gb of crap that can be deleted. Result!
Brain-dumps and useful information for my reference but published in case anyone else finds it useful.
Tuesday, 23 July 2013
Windows disk usage analysis
Having just started using windows much more frequently I needed to work out what was hogging all my disk space, this tool
Wednesday, 13 March 2013
Remove unused kernels and headers from ubuntu server
Yet again I found my system clogged up with unused kernels and headers. This time I am making a note of the one-liner to remove the unused junk.
(Found at http://tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/)
You can first check that the correct packages are selected to remove with;
and if you are happy remove those with this;
A word of warning, if you have installed a new kernel recently ensure you have rebooted since, and secondly ensure that your current kernel is not on the list of packages to remove of you will end up with a un-bootable system.
(Found at http://tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/)
You can first check that the correct packages are selected to remove with;
dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get --dry-run remove
and if you are happy remove those with this;
dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge
Labels:
12.04,
disk space,
kernel,
linux,
one liner,
precise,
remove unused kernels,
server,
ubutnu
eth0 naming persistance
I needed to change the physical hardware for an instance of Ubuntu Server 12.04 after some hardware failed, although most of the hardware changes were seamless the network adapter name changed from eth0 to eth1, the fix for which I found here.
http://www.serenux.com/2009/11/howto-fix-a-missing-eth0-adapter-after-moving-ubuntu-server-from-one-box-to-another/
Essentially the udev rule found at
Stores and makes persistent the names of the respective adapters. By removing the line relating the that adapter is identified by such as
http://www.serenux.com/2009/11/howto-fix-a-missing-eth0-adapter-after-moving-ubuntu-server-from-one-box-to-another/
Essentially the udev rule found at
/etc/udev/rules.d/70-persistent-net.rules
Stores and makes persistent the names of the respective adapters. By removing the line relating the that adapter is identified by such as
ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="00:a0:c9:78:9a:bc", NAME="eth0"
Subsequently the new adapter is then initialised with the name eth0.
Labels:
eth0,
eth1,
eth2,
ubuntu 12.04,
ubuntu server,
udev,
wrong name
Thursday, 21 February 2013
Logitech G500 mouse pointer jitter fix.
Logitech G500 Mouse jitter fix
So I brought a second hand Logitech G500 mouse which had some problems with jitter, when stopping the mouse quickly movement the pointer would briefly jitter a few pixels randomly.
After some googleing I found this blog entry - http://blog.ambor.com/2011/04/logitech-g500-mouse-rattle-jerky.html - which pointed me in the direction of the laser lens. Fixing the lens in place fixed the problem, the but as the original article has quite short on images I thought I would document it here.
The top of the laser sensor, the lens is held in place by the two transparent tabs - which you can see passing through the black sensor at in the middle of the PCB.
Job done!
Labels:
fix,
G500,
jerky movement,
jitter,
laser,
Logitech G500,
mouse,
movement
Thursday, 29 November 2012
Combining multiple video files with mencoder
The following command can be used to combine several files into a single file,
mencoder -idx -oac copy -ovc copy -o output.avi input1.avi input2.avi
Caveats:
- Files must be the same resolution
- Files must be encoded with the same codec (although different containers are ok)
Thursday, 4 October 2012
Google search from keyboard shortcut
Plan
I want to be able to run a google search based on text contained on the clipboard, this allows me to quickly search for text snippits I come across
Windows
From this site:
http://blogs.technet.com/b/heyscriptingguy/archive/2004/12/15/how-can-i-grab-a-url-from-the-clipboard-and-then-open-that-web-site-in-a-browser.aspx
I found a snippet of VBS script got me most of the way, the only thing to add is to adapt it so that it appends the string to the end of a google seach URL.
The final script looks like this
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
strURL = objIE.document.parentwindow.clipboardData.GetData("text")
objIE.Quit
Set objShell = CreateObject("Wscript.Shell")
strSearchURL = "http://www.google.co.uk/search?q=" & strURL
objShell.Run(strSearchURL)
You can then save this script with a vbs file extension and have it called when you press a certain keyboard shortcut or macro key.
By default this will prompt to allow the script to access the clipboard. You need to add "about:blank" to the trusted internet zone and set the "Programmatic clipboard access" to enabled not prompt.
By default this will prompt to allow the script to access the clipboard. You need to add "about:blank" to the trusted internet zone and set the "Programmatic clipboard access" to enabled not prompt.
Ubuntu
After looking into google searching from gnome-terminal the only solution looked a bit risky http://blog.ubuntu-tweak.com/2010/11/16/gnome-terminal-with-google-search-support.html
As a result I decided to look into a safer and more general option, that was using xsel and ubuntu keyboard shortcuts to open a browser tab searching for whatever is selected.
#!/bin/bash# Steve Fry http://cdtfry.blogger.com
# 04/Oct/2012
# Search based on selected text
search_string="http://www.google.com/search?q=$(xsel)"
# Search based on clipboard contents
# search_string="http://www.google.com/search?q=$(xsel --clipboard )"
# Open a chromium tab based on the search string.
chromium-browser "$search_string"
This can then be saved to a text file such as /home/steve/bin/google_from_clipboard.sh and then allocated to a keyboard shortcut using the ubuntu keyboard menu.
Steve
Sunday, 23 September 2012
Specifying IP range for tcpdump
I recently came across the need to specify a IP range for tcpdump (setting up an install of darkstat to monitor network usage by host - but ignoring traffic within my local network).
However the only solution I could find in pcap-filter syntax was to specify blocks of ip's by netmask.
After looking into filtering ip addressea by inspecting the packets themselves, (http://isc.sans.edu/diary.html?storyid=6667) I finally came across a comment on the bottom of the previous link which suggested using a script cidr_range.pl (http://archives.neohapsis.com/archives/postfix/2005-06/att-1279/cidr_range__charset_iso-8859-15) which translated ip ranges into a series of ip/cidr netmasks that can them be used to filter tcpdump (or in my case darkstat).
Therefore
which then filters out all traffic to or from hosts within the range 192.168.0.100-200.
Steve
Refs:
http://archives.neohapsis.com/archives/postfix/2005-06/att-1279/cidr_range__charset_iso-8859-15
http://isc.sans.edu/diary.html?storyid=6667
http://www.manpagez.com/man/7/pcap-filter/
http://www.tcpdump.org/tcpdump_man.html
However the only solution I could find in pcap-filter syntax was to specify blocks of ip's by netmask.
After looking into filtering ip addressea by inspecting the packets themselves, (http://isc.sans.edu/diary.html?storyid=6667) I finally came across a comment on the bottom of the previous link which suggested using a script cidr_range.pl (http://archives.neohapsis.com/archives/postfix/2005-06/att-1279/cidr_range__charset_iso-8859-15) which translated ip ranges into a series of ip/cidr netmasks that can them be used to filter tcpdump (or in my case darkstat).
Therefore
steve@dell-laptop:~$ perl cidr_range.pl 192.168.0.100 192.168.0.200can then be translated to
192.168.0.100/30
192.168.0.104/29
192.168.0.112/28
192.168.0.128/26
192.168.0.192/29
192.168.0.200/32
not (net 192.168.0.100/30 or net 192.168.0.104/29 or net 192.168.0.112/28 or net 192.168.0.128/26 or net 192.168.0.192/29 or net 192.168.0.200/32)
which then filters out all traffic to or from hosts within the range 192.168.0.100-200.
Steve
Refs:
http://archives.neohapsis.com/archives/postfix/2005-06/att-1279/cidr_range__charset_iso-8859-15
http://isc.sans.edu/diary.html?storyid=6667
http://www.manpagez.com/man/7/pcap-filter/
http://www.tcpdump.org/tcpdump_man.html
Labels:
darkstat,
ip,
linux,
pcap-filter,
range,
server,
tcpdump,
traffic monitor,
ubuntu
Location:
UK
Subscribe to:
Posts (Atom)


