Tims Blog

Backup Strategy

Lets talk backup! I just realised my strategy was not as good as it could have been, and I decided to improve it in various spots. My main issue was the lack of off-site backups, and to accomodate that, I chose Amazon S3. On my Macs I’m running Arq, which works like a charm. I do hourly backups of the most valuable data, using up to 50 GB of S3 Storage (currently using about 3GB). I use Arq on all of my Macs now, in addition to TimeMachine backup to my FreeBSD home server. The only machine left unbackuped was my Ubuntu server that hosts this page (and a few others, e.g. customer sites). To backup this machine I use duplicity, which is a script capable of uploading encrypted, differential backups to S3.

To include the MySQL data from me & my customers, I added automysqlbackup, which does daily, weekly and monthly snapshots from my SQL tables, which are then also included in the S3 backups. Automysqlbackup also sends me e-mails when anything goes wrong backing up, which I consider a really great feature. Additionally, the server is backed up daily by my hoster (Host Europe), which increases the security even further.

Mosh - Mobile Shell

I stumbled across mosh, a SSH replacement.

Mosh allows you to connect to your ssh-enabled server (after installing it to the server, too). It creates the connection for you, then starts its server-process (mosh-server). After closing the SSH-connection, it connects a local mosh-client to the remote server. It’s based on UDP, according to the website its ~3 times faster than SSH (mean performance of keystroke response time).

But the best thing about mosh is its reconnecting-abilities. When your computer loses its network connection, mosh waits for a route to the remote server to come up again, it then reconnects to your existing session, which is untouched. Even triggered events (like keystrokes) are sent to the server after reconnection.

Working Atmosphere

When it comes to creative work, I found out that I work best when the environment is inspiring and giving you the freedom you need. It might be the right wallpaper that gives you the kick you need (my collection, all attributions go to Interfacelift). I decided to switch them every 5 minutes, so they always feel fresh. To accompany the wallpapers I chose Instaview (MAS), to display 2 frames of Instagram images (Images taken near me & the Instagram top images). To unclutter my desktop, I created a “Junk” folder with a custom icon. (Icons & Manual).

Finished result:

Bootstrap Progressbar

I just made a simple Progressbar for Twitter Bootstrap, find it here: Gist.

It’s under the WTFPL .

js

Simple CSS Progressbar

I thought about developing a fast and simple statusboard, that can e.g. display statistics from a webapplication. And of course, it needs all kinds of status-displays. Here is one, a simple progress-bar, that can also display peak levels (or reference levels).

So no more big words, here’s the link:

https://gist.github.com/82ed3d423969a2e6526f (Just use it if you like it)

css, html, js

Reinstalling MacOS

Once in a while you reach the point where your system just doesn’t work right anymore. I reached that point some months ago, but didn’t have the time to reinstall everything and set it up again. This weekend i finally had some spare hours, so i cloned my internal SSD via Carbon Copy Cloner to a sparseimage and formatted it afterwards. After reinstalling Mac OS X Lion from scratch and some setup-work (xCode, Mail-Accounts, homebrew, oh-my-zsh and so on) i have a fast OS that performs like hell and doesn’t have any of those strange bugs it had before (e.g. not being able to install Ruby 1.9.2 via rvm.).

Using Varnish

I needed a small VCL for caching assets in Varnish. I used some tutorials and documentation to come to this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
sub vcl_recv{
    if (req.url ~ "(?i)\.(png|gif|jpeg|jpg|ico|swf|css|js|html|htm)(\?[a-z0-9]+)?$") {
     unset req.http.Cookie;
  }
  if(req.http.Cookie ~ "(PHPSESSID|other)") { 
                        # dont do anything, the user is logged in 
                } else { 
                        # dont care about any other cookies 
                        unset req.http.Cookie; 
                } 
}
sub vcl_fetch {
    unset beresp.http.server;
    unset beresp.http.X-Powered-By;
    if(req.url ~ "\.(png|gif|jpg|jpeg|ico)$"){
        set beresp.ttl = 2d;
        set beresp.keep = 2h;
        unset beresp.http.set-cookie;
    }
    if(req.url ~ "\.(css|js)$"){
        set beresp.ttl = 4d;
        set beresp.keep = 4h;
        unset beresp.http.set-cookie;
    }

}

It basically unsets cookies for all static contents, so Varnish can cache it. In the vcl_fetch it unsets the server that served the request and the X-Powered-By header to hide the PHP-Version. Then it checks if the request was for an image or an CSS/JS File and writes new TTL-headers and sets the Varnish keep time to cache images for 2 hours, for CSS/JS 4 hours. The vcl_recv also contains a rule to check for certain cookies to keep them and drop the ones not nessecary. With that rule we enable Varnish to cache content for anonymous users, altough we use Google Analytics / other analytics tools. (Varnish doesnt cache requests containing Cookies).

Just the First Post

1
2
puts "Hello World!"
expectations.add ["code", "ruby", "learning clojure", "design", "architecture"]

Tim