Posted by & filed under Linux.

If you’re using my previous method for logging a networks ever-changing public IP to a webserver you control, you can use this simple command to grab the last known IP and SSH into the box that way. ssh USERNAME@`curl -s http://www.example.com/pong.php` The `backticks`, when run in a shell, will execute that command and return the… Read more »

Posted by & filed under PHP.

<?php $raw_header = “http://location/\r\nBadHeader”; # PHP 5.4: $clean_header = explode(“\n”, explode(“\r”, $raw_header)[0])[0]); # PHP 5.3: $no_cr = explode(“\r”, $raw_header); $no_nl = explode(“\n”, $no_cr[0]); $clean_header = $no_nl[0]; unset($no_cr, $no_nl); echo $clean_header;

Posted by & filed under Linux.

Use this script to take a photo using the webcam on your computer. It makes use of and requires the installation of mplayer. When it takes pictures, it will take 20 of them, and delete the first 19. I have to do this because my netbook has a really crappy camera, and it takes a… Read more »

Posted by & filed under NoSQL.

$ brew install rethinkdb ==> Downloading http://download.rethinkdb.com/dist/rethinkdb-1.5.0.tgz Already downloaded: /Library/Caches/Homebrew/rethinkdb-1.5.0.tgz ==> ./configure –prefix=/usr/local/Cellar/rethinkdb/1.5.0 –fetch protobuf –fetch protoc ==> make make[1]: *** [build/release_clang_notcmalloc/rethinkdb_web_assets/js/reql_docs.json] Error 1 make[1]: *** Deleting file `build/release_clang_notcmalloc/rethinkdb_web_assets/js/reql_docs.json’ make[1]: *** Waiting for unfinished jobs…. make[1]: unlink: build/release_clang_notcmalloc/rethinkdb_web_assets/.: Invalid argument make: *** [make] Error 2 READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting The only thing Google brings up is… Read more »

Posted by & filed under Linux.

After moving to my new apartment, it was time to dust off the old Linksys router I had lying around. This thing has been hacked to run the latest DD-WRT that it could handle. My network address changes occasionally, and I didn’t want to setup any dyndns accounts to keep track of the IP and… Read more »

Posted by & filed under PHP.

<?php /** * This class will safely parse complex objects or arrays with possible missing keys * * Usage: obj::query($obj, ‘dot.separated.syntax’); */ class obj { /** * Parse the provided object * * @param $object mixed The complex object you’re going to parse * @param $path string The dot separated path you would like to… Read more »

Posted by & filed under NoSQL.

These are my notes for the talk I’m giving today on PHP and MongoDB. Example PHP script for communicating with MongoDB: #!/usr/bin/env php <?php // Instantiate the Mongo client $m = new MongoClient(); // Connect to a database. If it doesn’t exist, it will be created $db = $m->example; // Point to a collection within… Read more »

Posted by & filed under Personal.

If you know me, you know that I’m not a big fan of recruiters. Particularly, recruiters who take the shotgun approach to finding candidates by sending the same copied-and-pasted email to hundreds of potential applicants. I know that these are copied-and-pasted, because my various email accounts will get the exact same email sent minutes apart…. Read more »