$ rcsdiff /usr/local/Library/Formula/mutt.rb
===================================================================
RCS file: /usr/local/Library/Formula/RCS/mutt.rb,v
retrieving revision 1.1
diff -r1.1 /usr/local/Library/Formula/mutt.rb
5c5
< url 'ftp://ftp.mutt.org/mutt/devel/mutt-1.5.21.tar.gz'
---
> url 'http://prdownloads.sourceforge.net/mutt/mutt-1.5.21.tar.gz?download'
Monday, October 14, 2013
brew install mutt
It appears the mutt ftp server is down, but a minor change to the brew formula made things work:
Monday, September 30, 2013
bash script to backup compiled applescripts
#! /bin/bash
IFS=$(echo -en "\n\b")
for i in *.scpt
do
osadecompile "$i" > "${i%.scpt}.applescript"
done
Here are some short scripts I use:
---- Clean Desktop.applescript
on run
do shell script "chflags hidden ~/Desktop/*"
end run
---- Clutter Desktop.applescript
on run
do shell script "chflags nohidden ~/Desktop/*"
end run
---- Eject and Sleep.applescript
tell application "Finder" to eject (every disk whose ejectable is true)
tell application "Finder" to sleep
---- Skip Forward 30 Seconds.applescript
tell application "iTunes" to set player position to (player position + 30)
Thursday, September 26, 2013
Java regular expression: anchored versus unanchored greedy quantifier
Here's a simple Java program
When compiled and run, it produces
What's up with that first replacement? Why is the "that" doubled? Beats me...
$ cat Test.java
class Test
{
public static void main (String args[])
{
System.out.println ("this".replaceAll (".*", "that"));
System.out.println ("this".replaceAll ("^.*$", "that"));
}
}
When compiled and run, it produces
$ javac Test.java
$ java Test
thatthat
that
What's up with that first replacement? Why is the "that" doubled? Beats me...
$ java -version
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-456-11M4508)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-456, mixed mode)
Thursday, September 5, 2013
check_mk on OpenBSD
First, grab the most recent source, and extract and install it.
wget http://mathias-kettner.de/download/check_mk-1.2.2p2.tar.gz
gunzip check_mk-1.2.2p2.tar.gz
tar xf check_mk-1.2.2p2.tar
cd check_mk-1.2.2p2
gunzip agents.tar.gz
tar xf agents.tar
sudo cp check_mk_agent.openbsd /usr/local/bin/check_mk_agent
sudo chmod 755 /usr/local/bin/check_mk_agent
Then add the check_mk service to /etc/services.$ rcsdiff /etc/services
===================================================================
RCS file: /etc/services,v
retrieving revision 1.1
diff -r1.1 /etc/services
1c1
< # $OpenBSD: services,v 1.1 2013/09/03 18:52:00 beaty Exp beaty $
---
> # $OpenBSD: services,v 1.1 2013/09/03 18:52:00 beaty Exp $
296a297,298
>
> check_mk 6556/tcp
Add the service to /etc/inetd.conf and restart inetd$ rcsdiff /etc/inetd.conf
===================================================================
RCS file: /etc/inetd.conf,v
retrieving revision 1.1
diff -r1.1 /etc/inetd.conf
1c1
< # $OpenBSD: inetd.conf,v 1.1 2013/09/03 18:49:57 beaty Exp beaty $
---
> # $OpenBSD: inetd.conf,v 1.1 2013/09/03 18:49:57 beaty Exp $
50a51,52
> check_mk stream tcp nowait root /usr/local/bin/check_mk_agent
> check_mk stream tcp6 nowait root /usr/local/bin/check_mk_agent
$ sudo kill -HUP `cat /var/run/inetd.pid `
Open up the port in pf (and probably allow pings from the nagios host).$ sudo rcsdiff -r1.1 /etc/pf.conf
===================================================================
RCS file: /etc/pf.conf,v
retrieving revision 1.1
diff -r1.1 /etc/pf.conf
1c1
< # $OpenBSD: pf.conf,v 1.1 2013/09/03 18:54:56 beaty Exp $
---
> # $OpenBSD: pf.conf,v 1.2 2013/09/03 21:57:17 beaty Exp $
38c38,39
<
---
> pass in proto tcp from 128.117.64.51 to any port 6556
> pass in proto icmp from 128.117.64.51 to any icmp-type echoreq
$ sudo pfctl -f /etc/pf.conf
Monday, April 22, 2013
OSX ssh_askpass
I recently received this error on OSX when trying to ssh:
$ ssh me@somewhere
ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory
ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory
ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory
$
I had earlier used a 'sudo screen' to connect out a serial port. Somehow, the permissions on /dev/tty got hosed and ssh thought I wanted to authenticate using a graphical interface; bringing up a new terminal window solved the problem.
Friday, April 19, 2013
CentOS images and Eucalyptus
CentOS 6 won't bring up the graphical install with less that a gig of
memory, so you'll have to use the 'm1.xlarge' zone. Don't believe the
instructions at http://www.eucalyptus.com/docs/3.2/ag/images_lin.html#images_lin as followed exactly, one gets:
No better. Sigh. So, fire up virt-manager and do the install, making sure not to use LVM. For Eucalyptus, the first partition is the root, the second the rest of the disk space, and the third swap -- so install everything in the first partition. You can do the install without creating a swap partition or make it the second partition and go back and patch up /etc/fstab after booting within Eucalyptus.
You have to create the disk layout yourself, so that it's not LVM and there's no swap.
Then create a standard partition.
Make it mount on /, be EXT4, and take all the available space.
You'll be warned that there's no swap partition, but that's as planned.
That should do it for the disk setup.
Find out where the partition starts and ends:
Here's a diff of /etc/fstab
You might also have to change the network configuration so that the NIC provided by Eucalyptus is used as eth0 (or you can just remove the file and have the OS regenerate it):
$ /usr/libexec/qemu-kvm -cdrom ~/CentOS-6.4-x86_64-bin-DVD1.iso -drive if=scsi,file=CentOS-test,boot=off
qemu: hardware error: Unknown device 'lsi53c895a' for bus 'PCI'
CPU #0:
EAX=00000000 EBX=00000000 ECX=00000000 EDX=000006d3
ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000
EIP=0000fff0 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0000 00000000 0000ffff 00009300
CS =f000 ffff0000 0000ffff 00009b00
SS =0000 00000000 0000ffff 00009300
DS =0000 00000000 0000ffff 00009300
FS =0000 00000000 0000ffff 00009300
GS =0000 00000000 0000ffff 00009300
LDT=0000 00000000 0000ffff 00008200
TR =0000 00000000 0000ffff 00008b00
GDT= 00000000 0000ffff
IDT= 00000000 0000ffff
CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000
DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000
DR6=ffff0ff0 DR7=00000400
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
Aborted (core dumped)
So, we read elsewhere to take the scsi part out. This givesNo better. Sigh. So, fire up virt-manager and do the install, making sure not to use LVM. For Eucalyptus, the first partition is the root, the second the rest of the disk space, and the third swap -- so install everything in the first partition. You can do the install without creating a swap partition or make it the second partition and go back and patch up /etc/fstab after booting within Eucalyptus.
You have to create the disk layout yourself, so that it's not LVM and there's no swap.
Then create a standard partition.
Make it mount on /, be EXT4, and take all the available space.
You'll be warned that there's no swap partition, but that's as planned.
That should do it for the disk setup.
Find out where the partition starts and ends:
$ parted /var/lib/libvirt/images/CentOS-6.4.img
GNU Parted 2.1
Using /var/lib/libvirt/images/CentOS-6.4.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) u
Unit? [compact]? b
(parted) p
Model: (file)
Disk /var/lib/libvirt/images/CentOS-6.4.img: 10737418240B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1048576B 8590983167B 8589934592B primary ext4 boot
2 8590983168B 10737418239B 2146435072B primary linux-swap(v1)
(parted) q
We don't want to use a block size of 1 byte on CentOS, so we do a little calculation for the size: 8589934592/65536 = 131072 and the start: 1048576/65536 = 16. We can now grab the root filesystem:
$ dd if=/var/lib/libvirt/images/CentOS-6.4.img of=~beaty/CentOS-6.4.emi bs=65536 skip=16 count=131072
$ file ~beaty/CentOS-6.4.emi
/home/beaty/CentOS-6.4.emi: Linux rev 1.0 ext4 filesystem data (extents) (large files) (huge files)
To get the kernel and ramdisk:
$ mount -r -t ext4 -o loop,offset=1048576 /var/lib/libvirt/images/CentOS-6.4.img /tmp/centos
$ cp /tmp/centos/boot/vmlinuz-2.6.32-358.el6.x86_64 ~beaty
$ cp /tmp/centos/boot/initramfs-2.6.32-358.el6.x86_64.img ~beaty
I use the following script to bundle and upload; you'll have to change the file names and buckets to yours of course.
#! /bin/bash
KERNEL=vmlinuz-2.6.32-358.el6.x86_64
KERNELBUCKET=centos6
RAMDISK=initramfs-2.6.32-358.el6.x86_64.img
RAMDISKBUCKET=centos6
IMAGE=CentOS-6.4.emi
IMAGEBUCKET=centos6
# ---------------------------------------------
euca-bundle-image -i $KERNEL --kernel true
euca-upload-bundle -b $KERNELBUCKET -m /tmp/$KERNEL.manifest.xml
EKI=`euca-register $KERNELBUCKET/$KERNEL.manifest.xml | cut -f 2`
echo "EKI = $EKI"
euca-bundle-image -i $RAMDISK --ramdisk true
euca-upload-bundle -b $RAMDISKBUCKET -m /tmp/$RAMDISK.manifest.xml
ERI=`euca-register $RAMDISKBUCKET/$RAMDISK.manifest.xml | cut -f 2`
echo "ERI = $ERI"
euca-bundle-image -i $IMAGE --ramdisk $ERI --kernel $EKI
euca-upload-bundle -b $IMAGEBUCKET -m /tmp/$IMAGE.manifest.xml
euca-register $IMAGEBUCKET/$IMAGE.manifest.xml
Now, you can find the associated new filesystem and swap partition, and hook those up in /etc/fstab:# blkid
/dev/vda1: UUID="755338e8-3b28-4f74-afde-6efe8319e4de" TYPE="ext4"
/dev/vda2: UUID="9cd82546-4c6c-4ca6-9b97-ccd96a6a82cc" SEC_TYPE="ext2" TYPE="ext3"
/dev/vda3: UUID="52a0a91a-c910-4c08-9d73-6223cfaba293" TYPE="swap
Here's a diff of /etc/fstab
You might also have to change the network configuration so that the NIC provided by Eucalyptus is used as eth0 (or you can just remove the file and have the OS regenerate it):
# diff /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.orig
6a7,9
> # PCI device 0x10ec:0x8139 (8139cp)
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:7b:d5:27", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
>
8c11
< SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d0:0d:1c:15:3b:b5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
---
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d0:0d:1c:15:3b:b5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
Mounting an OpenBSD image on a Linux system
Use parted to find where the partition begins:
$ parted /var/lib/libvirt/images/OpenBSD52.img
GNU Parted 2.1
Using /var/lib/libvirt/images/OpenBSD52.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) u
Unit? [compact]? b
(parted) p
Model: (file)
Disk /var/lib/libvirt/images/OpenBSD52.img: 4294967296B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
4 32768B 10733990399B 10733957632B primary sun-ufs boot
(parted) q
Mount it:
$ mkdir /tmp/openbsd
$ mount -r -o loop,offset=32768,ufstype=44bsd /var/lib/libvirt/images/OpenBSD52.img /tmp/openbsd
Now you can grab files from it, including things like the kernel and ramdisk:
cp /tmp/openbsd/bsd /tmp/openbsd/bsd.rd ~beaty
Subscribe to:
Posts (Atom)






