Archive for January, 2013

Raspberry Pi & Cubieboard Benchmarks

January 17th, 2013 No comments
Simple write test: dd bs=1M count=1000 if=/dev/zero of=test
Ignore first run results
Copy of 13,000+ files: cp -a /var/* …
Raspberry Pi
android (busybox to nvram)
4.8 M/B/s
berryboot (raspbian squashfs) 4G(c4)
200M 16 +/- .5MB/s 7.8 +/- .1 MB/s
1G 11 +/- .5MB/s 8.3 +/- 1 MB/s
200M to SATA HD 63 +/- 2MB/s
1G to SATA HDD 45 +/- 2MB/s
13,727 files (/usr) from SD -> HDD (ext4) 9.2 sec
13,727 files (/usr) from HDD -> SD 38 sec
debian (drazbian) 16G(c10)
200M 22 +/- 2 MB/s
1G 7.6 +/- .5 MB/s
Categories: Linux Tags: , , , ,

Make squashfs Disk Image

January 17th, 2013 1 comment

Raspberry Pi (and Cubieboard) SD disk images typically have two (or three) partitions: the first is Fat32 (50-100MB) and includes the boot files, while the second (>1GB) contains the main Linux image. With compression, the combined image can be reduced from several GB (of mostly empty space) to a couple hundred MB.

With a regular Linux desktop computer that has kpartx and mksquashfs installed, you can convert the second partition to SquashFS like this:

$ sudo kpartx -av image_you_want_to_convert.img
add map loop0p1 (252:5): 0 117187 linear /dev/loop0 1
add map loop0p2 (252:6): 0 3493888 linear /dev/loop0 118784
$ sudo mount /dev/mapper/loop0p2 /mnt
$ sudo mksquashfs /mnt converted_image.img -comp lzo -e lib/modules
$ sudo umount /mnt
$ sudo kpartx -d image_you_want_to_convert.img

dd with gzip

January 16th, 2013 No comments

You can save a lot of space by compressing dd image files.
These examples use gzip but many other compression apps will work just as well.

backup with dd and gzip

dd if=/dev/wd0a | gzip -9 > /mnt/backup.gz

restore backup

gunzip /mnt/backup.gz – | dd of=/dev/wd0a

Categories: Linux, OS X Tags: , , , , , ,

XCode and Older iOS Devices

January 16th, 2013 No comments

With a bit of hacking, it’s possible to target older iOS devices than those normally supported by the latest SDK:

Categories: Development, OS X Tags: , , , , , , , ,

SourceTree from Command Line

January 16th, 2013 No comments

Download SourceTree command line tools from:

To open repo in current folder:

stree .

Categories: Development, OS X Tags: , , ,

Github Fork

January 16th, 2013 No comments

Configure remotes

To keep track of the original repo, you need to add another remote named upstream:

cd Spoon-Knife
git remote add upstream # Assigns the original repo to a remote called “upstream”

Pull in upstream changes

If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:

git fetch upstream                     # Fetches any new changes from the original repo
git merge upstream/master    # Merges any changes fetched into your working files

Categories: Development Tags: , , , , ,

git Submodule

January 16th, 2013 No comments

replace submodule repo

You should just be able to edit the .gitmodules file to update the URL and then run git submodule sync to reflect that change to the superproject and your working copy.

recursive submodule init and update

git submodule update –init –recursive

update only

git submodule update –recursive

recursive add submodule

git submodule add foo
git submodule update –init –recursive

Categories: Development Tags: , , ,

Mysterious MiniDLNA Ports

January 16th, 2013 No comments

MiniDLNA – Ports ssdp (1900/udp) and trivnet1 (8200/tcp) are proper of this service.
The other port (37167/udp) varies in every execution.

Categories: Linux Tags: , , ,

/private/var/vm Disk Usage on OS X

January 16th, 2013 No comments

It seems this is filled with multiple (roughly) 1GB swap files, allocated as required.
Problem is they don’t go away (until reboot?).
One article suggested this:

sudo dynamic_pager -L 1073741824

Seemed to work: before running vm used 8GB, afterwards 4GB

Categories: OS X Tags: , , , ,

Nginx with PHP on CentOS 6

January 16th, 2013 No comments


If you haven’t already done it, you have to set up the EPEL repository.

For 32bit:

rpm -Uvh

For 64bit:

rpm -Uvh

Next install Nginx and spawn-fcgi, I assume you have already installed PHP and all the modules you need.

yum install nginx spawn-fcgi

Now it’s time for the spawn-fcgi configuration. The config should be at /etc/sysconfig/spawn-fcgi.

vim /etc/sysconfig/spawn-fcgi

# You must set some working options before the “spawn-fcgi” service will work.
# If SOCKET points to a file, then this file is cleaned up by the init script.
# See spawn-fcgi(1) for all possible options.
# Example :
OPTIONS=”-a -p 9000 -u nginx -g nginx -C 32 -F 1 -P /var/run/ — /usr/bin/php-cgi”

It’s very important that you remember the port, you’ll have to set the same in the nginx configuration. You should also use the same username and group as nginx.
To play it safe, make sure the following line is not commented in the file /etc/init.d/spawn-fcgi:


Now let’s make sure that spawn-fcgi and nginx automatically start after a reboot.

chkconfig –level 2345 nginx on
chkconfig –level 2345 spawn-fcgi on

For more information about chkconfig check this site:

Next up we have to fix a folder permission. The group of the session cookies folder, the address can be found in the php.ini (session.save_path = “/var/lib/php/session”). The folder group has to be changed from apache to whatever you use, e. g. nginx. You should check this after every php update.

As a last step, just add the following line to the /etc/nginx.conf and/or your custom domain configuration in /etc/nginx/conf.d/yourdomain.conf.

location ~ .php$ {
include        fastcgi_params;
fastcgi_pass   localhost:9000;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

You should also make some additional changes in your configuration.

Categories: Development, Linux Tags: , , , ,