Posted by & filed under Webdev.

Monit is a Linux Daemon designed to monitor systems internally, can email you when they occur, and provides a nice web interface on port 2812. Additionally, it checks on an interval (every 2 minutes by default) that helps keep your server awake.

Posted by & filed under OSX.

Believe it or not, there’s a modifier command to change how paste works so that it removes all font styles and formatting in the pasting process, regardless of what is stored in the clipboard. It’s just a variation of the normal copy & paste trick:

Copy the text as usual with Command+C
Paste the copied text without formatting by using Command+Option+Shift+V
Notice the difference from the normal Command+V paste trick, which would include the formatting.

Posted by & filed under Webdev.

colout is a simple command to add colors to a text stream in your terminal.

The colout command line interface has been carefully designed to be simple. Basically, you will call it like: | colout [color [style]]

colout has the ability to use 8 colors mode, 256 colors mode, colormaps, themes and source code syntax coloring. Patterns are regular expressions.

You can think of colout as an alternative to grep –color which will preserve the surrounding context, whith more powerful coloring capabilites.

Posted by & filed under Webdev.

lxml is the most feature-rich and easy-to-use library for processing XML and HTML in the Python language.

#! /usr/bin/env python
# -*- coding: utf-8 -*-
import lxml.html

f = open('in.htm', 'r') #
html =
doc = lxml.html.document_fromstring(html)
for tr in doc.xpath('//*[@style="border: 1px solid rgb(178, 178, 178); width: 70px; height: 40px; overflow: hidden; margin-left: 5px;"]'):
	url = tr.getchildren()[0].attrib['href']
	preview = tr.getchildren()[0].getchildren()[0].attrib['src']
	print url, preview

Posted by & filed under Webdev.

Using base64 and gzip

$outfile=$_SERVER['argv'][2];if (!$infile || !$outfile) {
    die("Usage: php {$_SERVER['argv'][0]} <input file> <output file>\n");}
echo "Processing $infile to $outfile\n";
// compress data
// encode in base64
// generate output text
// write output text

Posted by & filed under Webdev.

Edit ~/.ssh/confing or /etc/ssh/ssh_config

Host           friendly-name
IdentityFile   ~/.ssh/private_ssh_file
User           username-on-remote-machine

Now you can connect using the friendly-name:

ssh friendly-name 

Posted by & filed under Webdev.

phpDeamon is Asynchronous framework in PHP. It has a huge number of features. Designed for highload. Each worker is able to handle thousands of simultaneous connections holding beer can. Main features and possibilites:

  • Powerful servers: HTTP, FastCGI, FlashPolicy, Ident, Socks4/5.
  • Many bundled clients like DNS, MySQL, Postgresql, Memcache, MongoDB, Redis, HTTP, IRC, Jabber, ICMP, Valve games client, etc.
  • Asynchrounous Filesystem I/O (using eio).
  • Many useful built-in applications like CGI.
  • Interactive debug console.
  • Dynamic spawning workers.
  • Chroot & Chdir for workers.
  • Automatic graceful reloading user’s scripts when it’s updated.
  • Graceful worker shutdown (and re-spawn if necessary) by the following limits: memory, query counter, idle time.