Thursday, 3 May 2012

Locations in Ubuntu datetime indicator

Ubuntu datetime indicator is a right pain to add extra timezones to.
The Locations... seems to be very poor when you try to add a new location at determining locations' full entry.
As an alternative you can add them to the configuration directly.
  • First install dconf-editor.
  • Open dconf-editor.
  • Navigate to con/canonical/indicator/datetime and edit the locations item with the locations you want.
Valid locations:
  • UTC UTC
  • America/Vancouver Vancouver
  • Australia/Sydney Sydney
  • Pacific/Auckland Auckland
  • Asia/Tokyo Tokyo
  • America/Toronto Ottawa

Wednesday, 7 March 2012

Programmatically find out if a file is sparse

You can work out if a file is sparse using stat (or fstat etc).

    struct stat statbuf;
    int ret = ::stat(tmp, &tatbuf);
    ASSERT_NE(ret, -1);

    // statbuf.st_size - virtual size in bytes
    // statbuf.st_blocks - physical size in 512-byte blocks
So if st_blocks * 512 < st.size then you definitely have a sparse file.

Sunday, 10 July 2011

ISO format for clock applet in Ubuntu 11.04

To configure Ubuntu Unity clock indicator applet to ISO format %Y-%M-%D

From: http://sysadmin.wikia.com/wiki/Ubuntu


gsettings set com.canonical.indicator.datetime custom-time-format "'%F %H:%M'"
gsettings set com.canonical.indicator.datetime time-format "'custom'"

Sunday, 24 April 2011

Compiling MosaicCK on Ubuntu 10.10

While I was trying to build /Mosaic-CK I had to add various libraries for Ubuntu 10.10 that might be non-obvious:


sudo aptitude install libx11-dev libmotif-dev libpng-dev \
libjpeg-dev libxt-dev x11proto-print-dev libxprintutil-dev \
libxprintapputil-dev libxcb-xprint0-dev libprinterconf-dev \
libxpm-dev


For Ubuntu 11.04 add:

 libxmu-dev

Wednesday, 15 December 2010

Open Source Digital Forensics

http://www2.opensourceforensics.org/home

Looks like it would be a good resource for anyone needing to rescue a machine or investigate one.

Friday, 19 November 2010

cgroups per tty on Ubuntu 10.04

I had some problems following http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html on Ubuntu 10.04, even following the Ubuntu instructions.

I think the problem is that cgroup was already mounted at /cgroups with default options, and that refused to allow a second mount, or allow non-root users to write to it.

So I altered the mount in fstab from 'defaults' to 'cpu', and make the /etc/rc.local script just do the subdir creation:


mkdir -m 0777 /cgroup/user
echo "/usr/local/sbin/cgroup_clean" > /cgroup/release_agent


With similar changes to the /usr/local/sbin/cgroup_clean and .bashrc files.

Friday, 23 April 2010

Memory Info

How to find out physical memory information:

Windows

Use cpu-z from http://www.cpuid.com/cpuz.php

Linux

Use:

dmidecode | grep -1 DIMM

From http://fixunix.com/hardware/262119-how-get-physical-dimm-count-under-linux.html