Dronken in #Utrecht, altijd goed
Fri Apr 30 16:55:07 +0000 2010
Op weg naar huis, misschien nog een biertje in de voortuin
Dronken in #Utrecht, altijd goed
Fri Apr 30 16:55:07 +0000 2010
Op weg naar huis, misschien nog een biertje in de voortuin
@gielium heel soms gezien, maar dat was met oude versie. Zou nu \(6\.30\.x\) gewoon moeten werken
I have an Asus EeePC on which I’ve installed Ubuntu 9.10. But now I wanted a working hibernate (suspend to disk) and suspend (suspend to memory).
Hibernate was working out of the box (well the going to sleep part, at least), but resuming took almost as long as a cold boot. Another thing was that my wireless was broken after a resume. On my happiness scale (range: 0-10) this scored a 3.
@digiplace heh :) Ik ga nu precies hetzelfde doen. Op naar de kelder!
Sun Feb 28 14:11:50 +0000 2010
Goed nog 100G backuppen en ik kan beginnen met installeren
Sun Feb 28 15:21:07 +0000 2010
Hmmm, zo weer ff de single user mode in om /home ext4 te maken en dan weer alles fixen \(kerberos, ldap, etc\)
Sun Feb 28 17:16:28 +0000 2010
Tip: maak een text dump van je ldap database als je van 32 bit naar 64 bit upgrade
I want to upgrade my server to the new Ubuntu and switch to 64 bit on my main server. This is how I managed to get Ubuntu Lucid (Alpha 3) running on my (test) machine, with RAID1 + BTRFS and 64 bit. It is a running story on how I spend my Saturday afternoon, you might need some decent Linux knowledge to follow my lead.
Here we go.
The following lists sums up my needs and troubles:
I’m no fan of Word or OpenOffice for that matter, all that WYSIWYG stuff is not for me. For years now I’m using LaTeX for my editing needs. An added bonus for using LaTeX is that the output is stunning.
But for really nice looking output I wanted the following:
I’m using the following tools for this:
’t was ff pielen, maar nu heb ik een mooie LaTeX mal voor Go, nu dan het moeilijkste: content
Sun Jan 31 11:41:05 +0000 2010
met fdisk /dev/sda kijken of je uberhaupt nog Windows hebt, maar die is dus echt weg \(dan maar geen HTC rom flash\)
Sun Jan 31 12:51:30 +0000 2010
redelijk in mijn nopjes met de layout: http://tinyurl.com/yezh73l
Sun Jan 31 15:39:24 +0000 2010
Fout gemaakt door 24 te gaan kijken
During the last few weeks I’ve attempted to translate the Go tutorial to Dutch. This was a lot more work than anticipated and I’m still not finished, but I just wanted to share what I’ve got up to now.
You can get the text version here.
Things do
One of the oldest tricks in the sys admin’s arsenal is
booting with init=/bin/bash. You’ll need this when
you want to reset the password for root for instance.
It used to go like this: Boot with init=/bin/bash and
after some time you greeted with a prompt ala
root@(none):/#
Most often I then took the following steps:
mount -o rw,remount /
/etc/init.d/networking start
Now you also have networking, so you may upgrade the
system with apt-get or whatever… You are now a
happy puppy.
Familiar with the following?
You are aware of (shell)file which contains a interesting line and you think: “I want to execute this line on the command prompt”. Most people will do the following:
% more <file>
[select interesting bit with your mouse]
[paste]<enter>
And the code gets executed.
I propose the following function: f(), which does the following:
vim of course);The code of the function looks like this:
There is better stuff in the standard Go release but I wanted to try
something for myself. In Go, this function is also called Map(), but is
(of course) nicer. Anyhow, I’m liking this Go stuff more and more. Next I
want to rewrite the DNS stuff in Go.
package main
import (
"fmt"
)
type e interface{}
func mult2(f e) e {
switch f.(type) {
case int:
return f.(int) * 2
case string:
return f.(string) + f.(string)
}
return f
}
func Map(n []e, f func(e) e) {
for k, v := range n {
n[k] = f(v)
}
}
func main() {
m := [...]e{1, 2, 3, 4}
s := [...]e{"a", "b", "c", "d"}
Map(&m, mult2)
Map(&s, mult2)
fmt.Printf("%v\n", m)
fmt.Printf("%v\n", s)
}
morgen nog lekker niksen en dan overmorgen naar huis
This is a translation from this article which is published in Dutch
During our work at Octrooicentrum Nederland somebody came up with the following question. During the night a file was created in a directory and he wanted to know who (which process) was responsible for that. My first reaction was: “Can’t be done”.
However, that evening I thought of inotify which could be of help.
With inotify you can watch your file system
and get notified when “something” (read, write, create, etc.)
happens. For (much) more detailed information look in inotify(7).
PS3 met modern warfare gekocht. VET!!
After reading up on the prime sieve, and playing with Go for the past week I thought needed to implement this algorithm in Go and make it parallel.
I want to create a set (n in 2..N) goroutines. Each of these routines will check if it can divide a number (i) by n (integer division). If so the number i is not prime, otherwise it is given to the next goroutine. Communication between the goroutines is done via channels as in this example.
Still learning and playing with Go, I’ve
rewritten my
cat experiment, to
use a *bufio.Reader, which is more correct I think. I’m also slowly
wrapping my mind around the concept of
Interfaces. As a
non-OO programmer (C and non-OO Perl) is starting to see why this is
useful.
So today’s exercises:
package main
// A implementation of cat in Go
import (
"os";
"fmt";
"bufio";
"flag";
)
var numberFlag = flag.Bool("n", false, "number each line")
func cat(r *bufio.Reader) bool {
i := 1;
for {
buf, e := r.ReadBytes('\n');
if e == os.EOF {
break
}
if *numberFlag {
fmt.Fprintf(os.Stdout, "%5d %s", i, buf);
i++
} else {
fmt.Fprintf(os.Stdout, "%s", buf)
}
}
return true;
}
func main() {
flag.Parse();
if flag.NArg() == 0 {
cat(bufio.NewReader(os.Stdin))
}
for i := 0; i < flag.NArg(); i++ {
f, e := os.Open(flag.Arg(i), os.O_RDONLY, 0);
if e != nil {
fmt.Fprintf(os.Stderr, "%s: error reading from %s: %s\n",
os.Args[0], flag.Arg(i), e.String());
continue;
}
if !cat(bufio.NewReader(f)) {
os.Exit(1)
}
}
}
package main
// A implementation of Unix grep in Go
// TODO(mg) better error handling
import (
"os";
"fmt";
"bufio";
"regexp";
"flag";
)
var numberFlag = flag.Bool("n", false, "number each line")
var filenameFlag = flag.Bool("l", false, "print names of matching files")
func grep(r *bufio.Reader, reg string) (match bool) {
i := 0;
for {
buf, e := r.ReadBytes('\n');
i++;
if e == os.EOF {
break
}
if m, _ := regexp.Match(reg, buf); m == true {
match = true;
if *filenameFlag {
return match
}
if *numberFlag {
fmt.Fprintf(os.Stdout, "%5.d: %s", i, buf)
} else {
fmt.Fprintf(os.Stdout, "%s", buf)
}
}
}
return match;
}
func main() {
flag.Parse();
if flag.NArg() < 1 {
fmt.Fprintf(os.Stderr, "%s: missing regexp\n", os.Args[0]);
os.Exit(1);
}
if flag.NArg() == 1 {
if grep(bufio.NewReader(os.Stdin), flag.Arg(0)) {
if *filenameFlag {
fmt.Fprintf(os.Stdout, "(standard input)\n");
}
}
}
for i := 1; i < flag.NArg(); i++ {
f, e := os.Open(flag.Arg(i), os.O_RDONLY, 0);
if e != nil {
fmt.Fprintf(os.Stderr, "%s: error reading from %s: %s\n",
os.Args[0], flag.Arg(i), e.String());
continue;
}
if grep(bufio.NewReader(f), flag.Arg(0)) {
if *filenameFlag {
fmt.Fprintf(os.Stdout, "%s\n", flag.Arg(i))
}
}
}
}
After spending every free minute to Go I’m starting to get a feel
for the language. Every one has to start somewhere, so I decided to
“port” Unix utils to Go. I’m starting with cat, and thanks to
the Go tutorial this is the result.
package main
// An implementation of Unix cat in Go
import (
"os";
"fmt";
"flag";
)
func cat(filename string) bool {
const NBUF = 512;
var buf [NBUF]byte;
if f, e := os.Open(filename, os.O_RDONLY, 0); e != nil {
fmt.Fprintf(os.Stderr, "cat: error reading from %s: %s\n",
filename, e.String());
return true;
} else {
for {
switch nr, _ := f.Read(&buf); true {
case nr < 0:
os.Exit(1)
case nr == 0: // EOF
return true
case nr > 0:
if nw, ew := os.Stdout.Write(buf[0:nr]); nw != nr {
fmt.Fprintf(os.Stderr,
"cat: error writing from %s: %s\n",
filename, ew.String());
return false;
}
}
}
}
return true;
}
func main() {
flag.Parse(); // implement -n TODO
if flag.NArg() == 0 {
cat("/dev/stdin")
}
for i := 0; i < flag.NArg(); i++ {
if !cat(flag.Arg(i)) {
os.Exit(1)
}
}
}
In something like 50 lines you have a cat program. I’m really starting
to like Go. Next up: extra features and a grep command.
I joined the go-nuts mailing list a few days ago and it really feels good to receive 200+ emails per day again. Just like in the good old days before good spam filtering (and anti-spam laws).
I also re-watched the presentation Rob Pike gave for Google Tech Talks
on youtube.com. In there he presented the following program chain.go:
(Formatted with gofmt as it should)
package main
import (
"flag";
"fmt";
)
var ngoroutine = flag.Int("n", 100000, "how may")
func f(left, right chan int) { left <- 1+<-right }
func main() {
flag.Parse();
leftmost := make(chan int);
var left, right chan int = nil, leftmost;
for i := 0; i < *ngoroutine; i++ {
left, right = right, make(chan int);
go f(left, right);
}
right <- 0; // bang!
x := <-leftmost; // wait for completion
fmt.Println(x); // 100000
}
In this short program we make a chain of 100000 goroutines which are connected to each other. Each one adds 1 to the value it gets from its right neighbor. We start it of by giving the last one (right) a value of 0. Then we wait until they are finished and print it.
I’ve been wanting to learn (and do something) with the language
Erlang for over two years now. But every time
I fire up vim and start typing a get a this-is-not-Unix feeling (aka
Java-sickness). The syntax is just not right for me.
But now Google, by the creators of Unix and C, give us Go! Which promises to give us Erlang functionality in a C-like language. Just what I wanted!
Basically just follow the steps on golang.org. In short it boils down to:
After running with the old style for a couple of years I wanted
something new. And after a few days battling with Wordpress I decided
to stay with nb, because it just rules.
The theme is loosly based on the design from Wordpress called
SimplicitlyDark and the css from
daring fireball.
But still a new (clean) style. During the restyling I also fixed
the archives and found out that nb cannot handle articles
with [[ in their name.
Apparently the cups driver (ppd) for Ubuntu (in both Karmic and
Jaunty) is not installed by default, see
this and
this for
more information.
The strange thing is that if you look at openprinting.org, it says
Dymo LabelWriter 400
Supplied with CUPS Works perfectly.
Supplied with cups??? Works perfectly?? How, where, when??
Well:
% apt-get source cups
% ls -l cups-1.3.9/ppd/dymo.ppd
-rw-rw-r-- 1 miekg miekg 24K Nov 27 2007 cups-1.3.9/ppd/dymo.ppd
And that’s your ppd file. For good measure I’ve put this up
for download here too.
100 GB of Ubuntu uploaded \(ratio: 149\) :-)
Sat Oct 31 09:47:36 +0000 2009
Erug leuke atb docu over de begin tijd van het atb-en: http://www.imdb.com/title/tt0907856/
My small and very personal comparison between Fedora 11 (which I run on my laptop) and Ubuntu 9.10 which is my main Linux distribution.
yum vs apt-getyum is a lot slower than apt-getyum searchyum defaults to ‘N’ (no) when I ask it to install software?All in all I like apt-get a lot better.
Very nice to see this in Fedora 11, I want this too for Ubuntu. Too bad Ubuntu does not use this in 9.10. It will happen in 10.04 (I heard).
I installed my new laptop with Fedora 11, and I must say that it is a very nice distribution. I’m even contemplating leaving PulseAudio enabled, ‘cause it just works. Unlike ubuntu.
To update my story on the KPN dongle (dongel). I just used it on this laptop and it worked out of the box. The only thing you need to remember is that you need to insert the stick before booting you machine. It will not work if you insert it afterwards. If you observe this rule it will just pop up in NetworkManager.
On my new netbook
I wanted to get rid of gdm and
just start X right away. I use auto-login anyway so it
is a bit stupid to first start gdm and then immediately start X.
So I removed gdm and edited /etc/rc.local to start X:
su - miekg -c xinit xterm
But this sort of does not work anymore in Ubuntu Karmic. Karmic
now uses upstart as an init replacement.
So I figured why
not write an upstart job that starts X?
I’ve bought a new 11.1" netbook from Asus, this is going to replace my aging 4G Surf (named charm). I’ve named the new one up, so I’m hoping the Large Hadron Collider is up and running soon and discovers a new flavor of quarks - ‘cause I’m running out of names. (strange is already allocated if I ever buy a Mac and run Linux on that, top and bottom just don’t sound right).
Okay, I could not find this in the specs, but I do find this fishy. When querying a Windows DNS server it will give out an authoritative answer (aa bit set), but without an AUTHORITY section.
dig +nocmd +noidentify +multiline @ns5.msft.net. soa hotmail.com
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;hotmail.com. IN SOA
;; ANSWER SECTION:
hotmail.com. 86400 IN SOA ns1.msft.net. msnhst.microsoft.com. (
2009100802 ; serial
1800 ; refresh (30 minutes)
900 ; retry (15 minutes)
2419200 ; expire (4 weeks)
3600 ; minimum (1 hour)
)
;; ADDITIONAL SECTION:
ns1.msft.net. 3600 IN A 65.55.37.62
And it gets worse:
iotop is a very neat tool showing the processes which do the most
i/o in a top-like manner.
Again having fun with SLES:
SLES-10:
# rpm -i /tmp/iotop-0.3.2-1.1.x86_64.rpm
warning: iotop-0.3.2-1.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID ee454f98
error: Failed dependencies:
python >= 2.5 is needed by iotop-0.3.2-1.1.x86_64
Goes off and installs SLES-11
SLES-11:
# rpm -i
warning: /tmp/iotop-0.3.2-1.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID ee454f98
error: Failed dependencies:
python < 2.6 is needed by iotop-0.3.2-1.1.x86_64
Nooooo!
An unofficial rpm of e2fsprogs installed on a SLES 10 system:
# ldd /sbin/e2fsck
libdb-4.3.so => /usr/lib64/libdb-4.3.so (0x00002b5e004e2000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b5e006d6000)
libc.so.6 => /lib64/libc.so.6 (0x00002b5e007ef000)
/lib64/ld-linux-x86-64.so.2 (0x00002b5e003c6000)
Now guess what happens when you reboot?