tag:blogger.com,1999:blog-11849022474550248602024-03-13T06:38:05.630-07:00Random musing on software and stuffAnonymoushttp://www.blogger.com/profile/08524723755405281340noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-1184902247455024860.post-39059184952237939942016-01-29T08:32:00.000-08:002016-01-29T08:32:21.756-08:00AutoStart randomness<a href="http://www.johndcook.com/blog/2016/01/29/random-number-generator-seed-mistakes/">John Cook's article on random generator mistakes</a> reminds me of a fun story from school:
We had Acorn Archimedes machines, which booted from the network - or at least loaded applications from the network, RiscOS was built into ROM.
These machines would often be idle after boot (the entire computer room switched on from a mains breaker), so to ensure they were most useful when someone came onto the machine later, we started various applications to run in the background.
This was fine if the machine wasn't going to be used immediately but very annoying if someone did want to use the machine, so I wrote !AutoStart, which started the applications after a delay, and could be cancelled with a click.
However a room full of machines all hitting the network at the same time for an application would be very slow, so I added randomisation, so different machines would start up applications at different times.
Unfortunately we hit the problem John highlighted - all the machines gave the same random numbers as they were all started at the same time (I think it may have been time since machine power up as well). So in the end machines initialised their random number generator with their network ID instead - predictable, but different from each other.
Anonymoushttp://www.blogger.com/profile/08524723755405281340noreply@blogger.com0tag:blogger.com,1999:blog-1184902247455024860.post-50261542669695907982012-09-10T03:01:00.001-07:002012-09-10T03:01:58.399-07:00NFSv4 on Virtual Box VMsSetting up NFSv4 mounts from the host (server) to the VirtualBox VM (client):
You can't use the normal NAT network - you'll get "Operation not permitted".
Setup a host-only network, and configure those devices on the host and vms.
That allows the connection to proceed to the next point.Anonymoushttp://www.blogger.com/profile/08524723755405281340noreply@blogger.com0tag:blogger.com,1999:blog-1184902247455024860.post-68800999727367778662012-05-03T05:55:00.000-07:002016-01-29T08:34:18.885-08:00Locations in Ubuntu datetime indicatorUbuntu datetime indicator is a right pain to add extra timezones to.<br />
The Locations... seems to be very poor when you try to add a new location at determining locations' full entry.<br />
As an alternative you can add them to the configuration directly.<br />
<ul>
<li>First install dconf-editor.
</li>
<li>Open dconf-editor.
</li>
<li>Navigate to con/canonical/indicator/datetime and edit the locations item with the locations you want.
</li>
</ul>
Valid locations:
<br />
<ul>
<li> UTC UTC
</li>
<li> America/Vancouver Vancouver
</li>
<li> Australia/Sydney Sydney
</li>
<li> Pacific/Auckland Auckland
</li>
<li> Asia/Tokyo Tokyo
</li>
<li> America/Toronto Ottawa
</li>
</ul>
Anonymoushttp://www.blogger.com/profile/08524723755405281340noreply@blogger.com0tag:blogger.com,1999:blog-1184902247455024860.post-80996317800133606962012-03-07T01:20:00.000-08:002016-01-29T08:34:03.341-08:00Programmatically find out if a file is sparseYou can work out if a file is sparse using <span style="font-family: monospace;">stat </span>(or <span style="font-family: monospace;">fstat</span> etc).<br />
<br />
<pre> 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
</pre>
So if st_blocks * 512 < st.size then you definitely have a sparse file.
Anonymoushttp://www.blogger.com/profile/08524723755405281340noreply@blogger.com0tag:blogger.com,1999:blog-1184902247455024860.post-70209109784234132162011-07-10T05:46:00.000-07:002011-07-10T05:49:53.153-07:00ISO format for clock applet in Ubuntu 11.04To configure Ubuntu Unity clock indicator applet to ISO format %Y-%M-%D<br /><br />From: <a href="http://sysadmin.wikia.com/wiki/Ubuntu">http://sysadmin.wikia.com/wiki/Ubuntu</a><br /><br /><pre><br />gsettings set com.canonical.indicator.datetime custom-time-format "'%F %H:%M'"<br />gsettings set com.canonical.indicator.datetime time-format "'custom'"<br /></pre>Anonymoushttp://www.blogger.com/profile/08524723755405281340noreply@blogger.com0tag:blogger.com,1999:blog-1184902247455024860.post-33383302258302502782011-04-24T00:07:00.000-07:002011-05-06T08:06:07.605-07:00Compiling MosaicCK on Ubuntu 10.10While I was trying to build <a href="http://en.wikipedia.org/wiki/Mosaic-CK">/Mosaic-CK</a> I had to add various libraries for Ubuntu 10.10 that might be non-obvious:<br /><br /><pre><br />sudo aptitude install libx11-dev libmotif-dev libpng-dev \<br /> libjpeg-dev libxt-dev x11proto-print-dev libxprintutil-dev \<br /> libxprintapputil-dev libxcb-xprint0-dev libprinterconf-dev \<br /> libxpm-dev<br /></pre><br /><br />For Ubuntu 11.04 add:<br /><br /><pre> libxmu-dev<br /></pre>Anonymoushttp://www.blogger.com/profile/08524723755405281340noreply@blogger.com0tag:blogger.com,1999:blog-1184902247455024860.post-19910836408174499422010-12-15T04:53:00.001-08:002010-12-15T04:54:01.615-08:00Open Source Digital Forensicshttp://www2.opensourceforensics.org/home<br /><br />Looks like it would be a good resource for anyone needing to rescue a machine or investigate one.Anonymoushttp://www.blogger.com/profile/08524723755405281340noreply@blogger.com0tag:blogger.com,1999:blog-1184902247455024860.post-40039821956796585862010-11-19T05:16:00.000-08:002016-01-29T08:34:29.782-08:00cgroups per tty on Ubuntu 10.04I had some problems following <a href="http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html">http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html</a> on Ubuntu 10.04, even following the Ubuntu instructions.<br />
<div>
<br /></div>
<div>
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.</div>
<div>
<br /></div>
<div>
So I altered the mount in fstab from 'defaults' to 'cpu', and make the /etc/rc.local script just do the subdir creation:</div>
<br />
<code><br />mkdir -m 0777 /cgroup/user<br />echo "/usr/local/sbin/cgroup_clean" > /cgroup/release_agent</code><br />
<br />
With similar changes to the /usr/local/sbin/cgroup_clean and .bashrc files.Anonymoushttp://www.blogger.com/profile/08524723755405281340noreply@blogger.com0tag:blogger.com,1999:blog-1184902247455024860.post-83469274525923228972010-04-23T03:16:00.000-07:002010-04-23T03:17:56.166-07:00Memory InfoHow to find out physical memory information:<br /><br /><span style="font-weight: bold;">Windows</span><br /><br />Use cpu-z from <a class="ext-link" href="http://www.cpuid.com/cpuz.php"><span class="icon">http://www.cpuid.com/cpuz.php</span></a><br /><br /><span style="font-weight: bold;">Linux</span><br /><p> Use: </p> <pre class="wiki">dmidecode | grep -1 DIMM<br /></pre><p> From <a class="ext-link" href="http://fixunix.com/hardware/262119-how-get-physical-dimm-count-under-linux.html"><span class="icon">http://fixunix.com/hardware/262119-how-get-physical-dimm-count-under-linux.html</span></a> </p>Anonymoushttp://www.blogger.com/profile/08524723755405281340noreply@blogger.com0