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:

https://stackoverflow.com/questions/7760946/is-it-possible-to-target-older-ios-versions-when-using-xcode-4-2-and-ios-5-sdk

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

SourceTree from Command Line

January 16th, 2013 No comments

Download SourceTree command line tools from:

https://downloads.sourcetreeapp.com/SourceTreeAppStoreCmdLineToolInstaller.pkg

To open repo in current folder:

stree .

Categories: Development, OS X Tags: , , ,

Github Fork

January 16th, 2013 No comments

https://help.github.com/articles/fork-a-repo

Configure remotes

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

cd Spoon-Knife
git remote add upstream https://github.com/octocat/Spoon-Knife.git # 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

from Black-Pixel.net:

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

For 32bit:

rpm -Uvh https://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

For 64bit:

rpm -Uvh https://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm

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 :
#SOCKET=/var/run/php-fcgi.sock
OPTIONS=”-a 127.0.0.1 -p 9000 -u nginx -g nginx -C 32 -F 1 -P /var/run/spawn-fcgi.pid — /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:

config=”/etc/sysconfig/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:https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-services-chkconfig.html

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: , , , ,

Windows Terminal Server: “Too many connections”

January 16th, 2013 No comments

There is one backdoor which can be used. Since Windows 2003 there is a little known feature which helps in a “too many connections” situation. The Remote Desktop client offers an option which allows you to connect to the console. This gives you a 3rd connection. If someone is logged into the console you have to have the sufficient permissions then the session will be logged out and you can log in. If nobody is logged into the console it will let you log in.

Start -> Run -> CMD
cd Program FilesTerminal Services Client
mstsc -v:x.x.x.x /console

Version Numbering

January 16th, 2013 No comments

I like this:

major: Really a marketing decision. Are you ready to call the version 1.0? Does the company consider this a major version for which customers might have to pay more, or is it an update of the current major version which may be free? Less of an R&D decision and more a product decision.

minor: Starts from 0 whenever major is incremented. +1 for every version that goes public.

release: Every time you hit a development milestone and release the product, even internally (e.g. to QA), increment this. This is especially important for communication between teams in the organization. Needless to say, never release the same ‘release’ twice (even internally). Reset to 0 upon minor++ or major++.

build: Can be a SVN/Git version, I find that works best.

For larger projects with many components Semantic Versioning makes sense, though it less end-user friendly.

Categories: Development Tags: , , , , ,