Linux: page 2
php_ssdeep Fuzzy Hashing PHP Extension
php_ssdeep Fuzzy Hashing PHP Extension **Updated 16/9:**php_ssdeep is now in PECL so I have updated this post to reflect that. On a recent project I needed a fast way to compare documents for likeness and return a percentage match. With much research and one unanswered Stackoverflow post later I came across Jesse Kornblum’s ssdeep utility intended for computer forensics such as looking for signatures in files when hunting rootkits etc. All the technical details of fuzzy hashing are described in his 2006 journal article Identifying almost identical files using context triggered piecewise hashing. Read more ⇒
A PHP wrapper for the unix at command
A project I am working on at the moment requires time delayed job queues and having found nothing yet that can manage it properly so I decided to wrap up `at` into a PHP class. This gives you simple methods to add, list and remove jobs from the `at` queue using object oriented code. The code is very simple and I have documented it reasonably well so along with the examples you should get on your way quickly. Read more ⇒
Batch remove extensions in Ubuntu
Batch remove extensions in Ubuntu Sometimes you will want to batch remove extensions from a load of files: for i in $(ls *.png); do mv $i ${i%.png}; done If you want to remove extensions from files with a .txt extension then you would replace the two instances of .png in the script above with .txt. You can take the extension off of all files using the following: for i in $(ls *. Read more ⇒
If you are having problems getting Ubuntu atd running
If you just cannot get atd to start running check the permissions on your /var/spool/cron/atjobs and /var/spool/cron/atspool directories. The should be `chmod 770` and then `chmod +t`. Also they should be owned by `daemon:daemon`. I was getting this error when attempting to set new at jobs: Can’t open /var/run/atd.pid to signal atd. No atd running? If I tried to start the daemon through the service management I was getting: sudo service atd start start: Job is already running: atd Read more ⇒
Moving to git and setting up InDefero as a web frontend
Most of our development is done on Vista desktops (although I also run Ubuntu of course) and we wanted a web interface for easy browsing of code so I needed to use a pervasive and well supported VCS. After much hunting around and looking at Bazaar, Mercurial and git I decided to go with the latter due to its support in the community. There are still some reservations I have against git, which work well for Linux kernal development but not our day to day web development – the major one being that subversion would allow you to commit and update on a file by file basis where as git versions the entire repository at once as far as I am aware. Read more ⇒
I use most of these commands every day to simplify my terminal interactions with an Ubuntu development box. This is more of a personal reference but thought I would share incase you find it useful. Task Command Get all users on the system for user in `getent passwd | cut -d: -f1`; do id $user; done Delete all .svn or any file name by replacing .svn in the command with your filename Read more ⇒
Samba File Share Over SSH Tunnel
This is not a post about setting up Samba shares. If that is what you are looking for then I can recommend the following book; Using Samba: A File & Print Server for Linux, Unix & Mac OS X. Sometimes you need to be able to access a remote Samba server in a secure manner from a Windows machine. This is a relatively simple procedure on an XP SP3 machine like mine linking into an Ubuntu server pre setup with Samba file sharing. Read more ⇒
Memcached and APC: Two Simple Techniques to Speed up your PHP Webpages
Memcached and APC are two tools that you can install on your server and gain almost instant gratification! APC basically caches executions that you send to a PHP process so that the next time you ask the parser to run your script it only has to look for some pre-chewed opcode in memory rather than parsing your PHP from the disk. APC also has another feature up its sleeve, memory object caching, which allows you to store objects such as results from a database table in memory. Read more ⇒
Installing APC and Memcached for PHP Sessions on Ubuntu and Debi…
Installing APC on Debian or Ubuntu is as simple as: **user@server:/directory/$** sudo apt-get install php-apc Now let us reboot the Apache process to enable our new cache: **user@server:/directory/$** sudo /etc/init.d/apache2 restart APC should now be ready to run on your server. Try running the following command to verify it is setup; you should get something in response like mine: **user@server:/directory/$** php -r ‘phpinfo();’ | grep ‘apc’ apc MMAP File Mask => /tmp/apc. Read more ⇒
Using phing for good - Unfuddle Add Repository and SVN Import Ta…
As you may be aware I have recently been playing with the excellent Agavi framework and it introduced me to the interesting phing tool. Phing can be used to automate tasks with build files that are close to interoperable with Apache Ant, which uses XML files to configure builds. The advantage phing has for us PHP users is that it is entirely written in PHP so extending it is as simple as adding a new class. Read more ⇒