Most interesting links of July ’14

Recommended Readings Video: The Unreasonable Effectiveness of Dynamic Typing for Practical Programs – a static-typing zealot turned friend of dynamic typing under the experience of real-world projects and problems shares thoughts about the limits of type systems (f.ex. both energy and torque are measured in N*m yet cannot be combined) and their cost: according toContinue reading “Most interesting links of July ’14”

Running A Leiningen/Ring Webapp As A Daemon Via Upstart (Ubuntu)

Running a Java/Clojure app as a daemon on Linux used to be hard but is pretty simple with Ubuntu Upstart (docs). The short story: Create an all-in one uberjar via “lein with-profile production ring uberjar” (using the lein-ring plugin; a simple lein uberjar would suffice for an app with a main- method) Create an upstartContinue reading “Running A Leiningen/Ring Webapp As A Daemon Via Upstart (Ubuntu)”

Tool Tip: Byob – Screen With Text UI

Screen (man) is very useful for running terminal sessions on remote computers that enable the user to disconnect and re-connect. Byobu (man), formerly also called screen-profiles, is a wrapper script for screen that adds status lines with useful info to screen and provides text UI for configuring it (byobu-config). Screen allows you to have multipleContinue reading “Tool Tip: Byob – Screen With Text UI”

Using Java as Native Linux Apps – Calling C, Daemonization, Packaging, CLI (Brian McCallister)

This is a summary of the excellent JavaZone 2012 talk Going Native (vimeo) by Brian McCallister. Content: Using native libraries in Java and packaging them with Java apps, daemonization, trully executable JARs, powerful CLI, creating manpages, packaging natively as deb/rpm. 1. Using Native Libs in Java Calling Native Libs Calling native libraries such as CContinue reading “Using Java as Native Linux Apps – Calling C, Daemonization, Packaging, CLI (Brian McCallister)”

AWK: Extract Logs for the Given Date(s) from a Log File

If your log file has entries like these: Then you can use the following bash script snippet to extract logs only for a particular day or consecutive days, including everything – even lines not starting with the date such as stacktraces – between the first log of the date up to the first log ofContinue reading “AWK: Extract Logs for the Given Date(s) from a Log File”

SSH magic: Authorize only once for multiple ssh/scp invocations

OpenSSH has a nice feature that makes it possible to open one “master connection”, which can be shared by multiple subsequent ssh/scp/sftp “slave connections”. The advantage is that you need to supply password only when opening the master connection and thus you can easily perform a sequence of remote commands without constant re-authentication. Let’s seeContinue reading “SSH magic: Authorize only once for multiple ssh/scp invocations”

An encrypted backup of a disk/partition to a Samba share with Clonezilla

You will learn how to customize Clonezilla Live (v. 1.2.5-24) for an easy backup of a partition (or a disk) to an encrypted file stored on a remote Samba server and how to test the backup by restoring it to a VMware virtual machine. We will few scripts to simplify the task, including a customContinue reading “An encrypted backup of a disk/partition to a Samba share with Clonezilla”