1. run-it

    I deployed a NodeJS Express app behind an nginx reverse proxy and wanted to have the node process supervised so it would automatically be restarted after crashes. I learned about a nifty service supervision suite called runit (inspired by D.J. Bernstein’s daemontools) from working at Cloudkick that would be perfect for the job.

    runit has a prgram called runsvdir that monitors a particular directory for subdirectories that represent services. It launches a runsv process for every subdirectory and runsv executes a run script that you create to execute your service. In the Debian runit package, runsvdir watches /etc/service though you should create your service directory under /etc/sv and symlink it into /etc/service so you can test your run scripts.

    The catch was, I wanted to run node with an unprivileged user and have the service directory in my home directory so I didn’t have to bother with sudoing. This is possible by having another runsvdir process monitor /home/mark/service. Here’s how I set it up:

    /etc/sv/
    |-- runsvdir-mark/
          |-- log/
          |    |-- main/
          |    `-- run*
          `-- run*  
    
    /etc/service/
    `-- runsvdir-mark@ -> /etc/sv/runsvdir-mark/
    
    /etc/sv/runsvdir-mark/run:  
    #!/bin/sh
    exec 2>&1
    exec chpst -u mark runsvdir /home/mark/service/
    
    /etc/sv/runsvdir-mark/log/run:
    #!/bin/sh
    exec chpst svlogd -tt ./main/
    
    .
    

    With that, there’s now a runsvdir process monitoring /home/mark/service. I then created:

    /home/mark/service
    |-- aubergine-0/
          |-- log/
          |    |-- main/
          |    `-- run*
          `-- run*  
    
    /home/mark/service/aubergine-0/run:
    #!/bin/sh
    exec 2>&1
    exec chpst -e /home/mark/service/aubergine-0/env \
    node /home/mark/code/aubergine/aubergine.js
    
    /home/mark/service/aubergine-0/log/run:
    #!/bin/sh
    exec chpst svlogd -tt ./main/
    

    1 year ago  /  0 notes

  2. Slow sudoing

    I’ve been noticing that using sudo was taking an unusually long time to execute on my prgmr server—commands like sudo vim /tmp/foo would hang for 3-5 seconds before finally opening vim for editing. I assumed it was due to poor I/O in a shared environment, but it persisted for a while so I finally decided to investigate.

    It turns out every time you use sudo, PAM tries to resolve your IP. There’s more detail in Redhat’s Bugzilla, bug #479464.

    The solution is to add your hostname to /etc/hosts:

    127.0.0.1 <HOSTNAME>.<DOMAIN> <ALIAS>
    

    1 year ago  /  0 notes

  3. To make it hard to quit they got a dog together. It’s supposed to be the company’s dog, not either of theirs individually. The idea being that now the company can’t go away or there’s no one to take care of the dog. Increased the burn rate a little but turned out to be a net win.
    pg on the founders of WePay.

    1 year ago  /  0 notes

  4. http://en.wikipedia.org/wiki/Dino-Riders

    http://en.wikipedia.org/wiki/Dino-Riders

    1 year ago  /  0 notes

  5. Floyd&#8217;s &#8220;tortoise and the hare&#8221; cycle-finding algorithm

I&#8217;d like to see Conrad Barski illustrate an algorithms book.

    Floyd’s “tortoise and the hare” cycle-finding algorithm

    I’d like to see Conrad Barski illustrate an algorithms book.

    2 years ago  /  0 notes  /  Source: Wikipedia

  6. delicious Bookmarklet for Opera

    Compatible with the recent delicious update:

    “post to delicious” bookmarklet

    3 years ago  /  0 notes

  7. Hung Up on SSH?

    ”~.” to disconnect.

    3 years ago  /  1 note

  8. Guilty Pleasures

    I sometimes edit my .emacs file in vim.

    4 years ago  /  2 notes

  9. Oy! Traffic Cops

    I just discovered a show called Traffic Cops that airs on BBC One/UKTV People. It’s essentially the British version of “Cops” with less trash.

    The British police look pretty spiffy in their uniforms and Volvos.

    4 years ago  /  0 notes

  10. Slim-Vim

    Larry Clapp announced that he is abandoning development on Slim-Vim.

    :(

    4 years ago  /  0 notes

  11. Spork Ion3

    Tuomo Valkonen on Ion3: “I’m not going to make it easy for all the forkers…”

    What a prick. I’m going to give xmonad a shot.

    4 years ago  /  0 notes

  12. HTTP Referer

    I was writing a WordPress plugin earlier today and noticed an inconsistency in spelling while referencing other plugins..

    Wikipedia on Referrer: “Referer is a common misspelling of the word referrer. It is so common, in fact, that it made it into the official specification of HTTP – the communication protocol of the World Wide Web – and has therefore become the standard industry spelling when discussing HTTP referers.”

    Use a spell checker next time, asshole.

    4 years ago  /  1 note

  13. Ellipses

    Ellipses are too long. I prefer to use “..” as a fair middleground between a period and full-blown ellipsis.

    4 years ago  /  0 notes