Slow ipython in osx yosemite?

Seems AppNap puts ipython to sleep, try this to disable it:

defaults write org.python.python NSAppSleepDisabled -bool YES

Error installing python module that uses pbr

If you get the following error when running python install:

error in setup command: Error parsing somemodule/setup.cfg: OSError: [Errno 2] No such file or directory

It is because git is not installed. On debian apt-get install git-core and you should be all set.

Finding Apache Average Memory Usage on Debian Wheezy

I wanted to find the average process memory usage on Debian wheezy to calculate MaxClients.

I used this script to do it:

sudo ps -ef | grep apache2 | grep -v ^$USER | awk '{ print $2 '} | xargs sudo pmap -d | grep ^mapped: | awk '{ print $4 }' | cut -dK -f1 | awk '{SUM += $1} END { print SUM/NR }'

Quick explanation, starts out with a process list, filters for apache2, removes the grep command from the list, prints the second column, uses pmap to display memory usage, then grep to filter out the mapped memory. Again printing the fourth column, then using cut to remove the K, and awk to sum up the records. NR in awk is the number of input records seen so far.

To get MaxClients divide your total memory (minus some margin for other system processes) by the average process memory usage to get the number for MaxClients.

Example, 50K process size, memory of 1.8G, 1.8G/50K = 36

Note you shouldn’t use the ps VSZ as it includes shared memory.

USB Linux Install

Create usb net inst device for x41 tablet. Because of conflicts with SATA and the usb cdrom I couldn’t get an install to work with the usb cdrom. I could get the installer to start, but it wouldn’t detect the hard drive no matter what I did. I tried loading t he drivers manually, but nothing worked. I decided to try my luck with an old Lexar Jump Drive (256M). It worked! See my notes below.

  • Partition usb key (/dev/sda) – cfdisk /dev/sda
  • Create msdos filesystem on partition – mkdosfs /dev/sda1
  • Run syslinux on partition – syslinux /dev/sda1
  • Mount the partition – mount /dev/sda1 /mnt
  • Copy the files from here to /mnt
  • Copy the net inst iso to the partition –
  • Run lilo on the drive to create MBR – lilo -M /dev/sda
  • Unmount the partition – umount /mnt
  • Try your luck!

Create Image over network in Linux

Create image of hdd over network with linux

Copy Image over network

# on receiving machine
nc -l -p 9000 | dd of=tablet.sda
# on sending machine
dd if=/dev/sda | nc 9000