Friday, August 27th, 2010
I’ve had a need to use the PHP SSH2 PECL recently (working on making a product, at work, more efficient) And thought I would share some of the preliminary code. You can find it here: vpssh.phps The most interesting thing is not vpssh_core or it’s exec (though it’s good code) the really interesting thing is [...]
Wednesday, January 6th, 2010
I find this concept fascinating and plan to investigate further down this road.
Tuesday, October 6th, 2009
If you’re ever in a situation where something is only happening intermittently, and only on a live server, and only while it’s under load… Lets say its not generating any error_log or stderr output, and you cant run it manually to reproduce… (we’ve all been in this situation) How do you get any debugging output [...]
Tuesday, October 6th, 2009
in LimeChat.app/Contents/Resources/logrenderer.rb around line 419… WFM. IANAL. YMMV. RTFM. OMGWTF. WTL. GTFO. ETC. words.each do |w| next if w.empty? s = body offset = 0 # rex = Regexp.new(w, true) # while rex =~ s # begin # left = $~.begin(0) right = $~.end(0) pre = $~.pre_match post = $~.post_match ok = true if exact_word_match [...]
Wednesday, September 16th, 2009
When working with user provided images in PHP you run into a problem. Lets say that you want to generate thumbnails of uploaded JPEGs for users. This is a fairly common use case where you would employ PHP and GD (the most prevalent php image extension.) But when you generate the new, smaller, image what [...]
Thursday, March 19th, 2009
Here’s a small bit of advice for all you would-be “cloud storage providers.” Just because you have a buttload of disks doesn’t mean people will be falling over themselves to use your software. If I have to spend *any* of my time worrying about your load, storage, or other internal algorithms (or unnecessary limitations for [...]
Wednesday, February 18th, 2009
Lets say you have the CouchDB classes (located here) all compiled together and included into your test.php script. Lets also say that you have created a database with the built-in web ui called “testing”. Finally let us say that your test.php has the following code in it, which would add a record to the db [...]
Friday, January 23rd, 2009
I do a lot of things for Automattic, and many of the things I do are quite esoteric (for a php developer anyways.) Perl is not my language of choice, but I’ve never balked at a challenge…. just… did it have to be perl? Anyways. We have more than a thousand machines that we track [...]
Thursday, December 11th, 2008
This is a simplistic use of the pattern that I wrote about in my last post to wait on multiple commands in bash. In essence I have a script which runs a command (like uptime or restarting a daemon) on a whole bunch of servers (think pssh). Anyways… this is how I modified the script [...]
Friday, December 5th, 2008
You know that you can run something in the background in a bash script with ( command )&, but a coworker recently wanted to run multiple commands, wait for all of them to complete, collect and decide what to do based on their return values… this proved much trickier. Luckily there is an answer #!/bin/bash [...]