Command line

  • POSIX (XCU "Shell & Utilities"): vi(1), awk(1), make(1), bc(1), sed(1), grep(1), sort(1), uniq(1), tee(1), wc(1), etc.
  • GNU Screen (useful to echo exec screen -xR >>~/.profile on a remote host)
  • Git: git-grep(1), git-stash(1), git-bisect(1), etc.
  • Ledger (useful for optimizing both finances and time)
  • Taskwarrior (TODO manager, highly recommended)
  • drive (one of CLIs for Google Drive)
  • Jekyll (generates static websites from markdown)


Chrome OS

  • Google Keep (quite convenient for grocery lists)
  • Google Drive (directly accessible in Chrome OS' Files)
  • Secure Shell (the main SSH client for Chrome OS, supports SFTP in Files and SSH bookmarks, type ssh in the address field)
  • Wolfram Alpha (type = universe age in planck times in the address field)

Disclaimer: I'm celebrating five years as a Chromebook user.

Here is one way to profile calendars:

  1. Export calendars in iCalendar format.
  2. Check out this Awk script:

    function parse(dt)
    	Y = substr(dt, 1, 4);
    	M = substr(dt, 5, 2);
    	D = substr(dt, 7, 2);
    	h = substr(dt, 10, 2);
    	m = substr(dt, 12, 2);
    	s = substr(dt, 14, 2);
    	return Y "/" M "/" D " " h ":" m ":" s;
    	dtstart = "";
    	dtend = "";
    	summary = "";
    /^DTSTART:/ {
    	sub(/\r$/, "");
    	sub(/^DTSTART:/, "");
    	dtstart = parse($0);
    /^DTEND:/ {
    	sub(/\r$/, "");
    	sub(/^DTEND:/, "");
    	dtend = parse($0);
    /^SUMMARY:/ {
    	sub(/\r$/, "");
    	sub(/^SUMMARY:/, "");
    	gsub(/  */, " ");
    	summary = $0;
    /^END:VEVENT/ {
    	if (dtstart && dtend && summary) {
    		print "i " dtstart " " prefix summary;
    		print "o " dtend;

  3. Have the Ledger utility installed:
    sudo apt install ledger # or whatever
  4. Convert the exported ICS files to timelog format:
    awk -f ics2tc.awk *.ics >
  5. Generate various reports from timelog, for example:
    ledger -f b -S -T
  6. Optionally specify a prefix:
    awk -f ics2tc.awk -v prefix=Work: Work.ics >
  7. Or even create a Makefile like this:

    all: $(TIMELOGS)
    	-rm -f $(TIMELOGS)
    .SUFFIXES: .ics .tc
    	awk -f ics2tc.awk -v prefix=$*: $< >$@

  8. ?????
  9. PROFIT!!1oneone

<svg xmlns=""
	viewBox="0,0 5,5"
<path d="M0,0 L5,0 L5,2 L4,2 L4,1 L1,1
	L1,4 L4,4 L4,3 L5,3 L5,5 L0,5 Z" />
<path d="M2,2 L2,3 L3,3 L3,2 Z">
<animateMotion begin="mouseover" restart="whenNotActive"
	keyPoints="0; .5; .5; 1"
	keyTimes="0; .36; .64; 1"
	keySplines=".5 0 .5 1; 0 0 1 1; .5 0 .5 1"
	path="M0,0 L2,0 Z" />
I am currently working on implementing needed reduction for interaction nets. To do that, I first needed to refactor a lot of somewhat ugly fast-written code in inet-lib. At some point, I changed retrieving an element from an array to .pop() from .shift(), just because in JavaScript the former happens to be a cheaper operation than the latter.

Many commits later, I decided to play with the program a little bit and compare performance between .shift()ing and .pop()ing. Boom! The program appeared to be broken. Even worse, invariance of the queue that is represented by that array with respect to the order in which it is processed is the whole point of interaction nets, namely the property of strong confluence also known as the one-step diamond property. I thought I fucked up hard.

First, I took a look at git-blame(1) for the line of code that calls .pop(), and found the corresponding commit. Then, I marked its parent commit as good with git-bisect(1). After a few steps, git-bisect(1) found the first bad commit.

Evidently, the problem had something to do with indirection applied by non-deterministic extension of interaction nets. And it did not take more than a couple of minutes to figure out a simple one-liner fix.

Overall, it took less than half an hour from finding a bug to fixing it which I first thought would take hours if not days. To me, it looks like yet another evidence that the idea of git-bisect(1) is totally genius. So, thanks again, Linus!

P. S. Free advice: when making commits, it is always useful to keep in mind 1) a possible need to git-grep(1) some lines of code later, and 2) almost inevitable need to deal with bugs which is a lot easier when commits are suitable for git-bisect(1).

Один из вариантов того, как можно читать классическую монографию по λ-исчислению [1]:

параграф 2.1;
упр. 2.4.1 (i)-(iii), 2.4.2-2.4.13;
упр. 2.4.15 (только в оригинале [2]);
параграф 2.2;
упр. 2.4.14;

параграфы 3.1-3.3;
упр. 3.5.1 (v), 3.5.1 (i), 3.5.6 (i), 3.5.2, 3.5.3, 3.5.11;
параграфы 13.1-13.2 до приложения 13.2.3 включительно;

часть II (главы 6-10);

параграф 4.1;
упр. 4.3.2, 4.3.4;
главы 15 и 16.

В каком-то приближении именно этот материал изложен чрезвычайно кратко в [3] (по-русски).

[1] Х. Барендрегт. Ламбда-исчисление, его синтаксис и семантика. Москва, 1985.
[2] H. P. Barendregt. The Lambda Calculus, Its Syntax and Semantics. North-Holland, 1984.
[3] A. Salikhmetov. Lambda Calculus Synopsis. arXiv:1304.0558, 2013.
$ cat >c.c
#include <stdio.h>

int main()
        fprintf(stdout, "stdout\n");
        fprintf(stderr, "stderr\n");
        return 0;
$ cc c.c
$ 3>&2 2>&1 1>&3 ./a.out | tee log
$ cat log

$ make
iverilog -Wall -DSIM -o comb comb.v
0381353f9 0 b2e09fd28ea2916f526a8dbb3a92235f0ddb9b0b1ccd0e7d9b5786f91b62031e
0381353fa 1 00000000627d0f02061ce63584c20662272c527d21f17dfaffb20d7de340423d
0381353fb 0 c90dd726ebe7c2770808fe574e85aba7e90ba2aea8998c70bcb24781d4010955
root@debian:~# apt-get install tor
Reading package lists... Done
Building dependency tree       
Reading state information... Done
root@debian:~# grep '^Hidden' /etc/tor/torrc
HiddenServiceDir /var/lib/tor/honey/
HiddenServicePort 22
root@debian:~# /etc/init.d/tor restart
Stopping tor daemon: tor.
Raising maximum number of filedescriptors (ulimit -n) to 8192.
Starting tor daemon: tor...
May 03 20:08:30.201 [notice] Opening Socks listener on
root@debian:~# torsocks ssh `cat /var/lib/tor/honey/hostname`
root@ohdzjoric6qwtr2c.onion's password: 
Linux debian 2.6.32-5-amd64 #1 SMP Mon Feb 25 00:26:11 UTC 2013 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri May  3 20:10:22 2013 from localhost
root@debian:~# dd if=/dev/urandom of=data count=1k
1024+0 records in
1024+0 records out
524288 bytes (524 kB) copied, 0.081219 s, 6.5 MB/s
root@debian:~# md5sum data
81d52fca4cfe42dca24659850139672a  data
root@debian:~# logout # latency about 1-2 sec.
Connection to ohdzjoric6qwtr2c.onion closed.
root@debian:~# torsocks scp `cat /var/lib/tor/honey/hostname`:data copy
root@ohdzjoric6qwtr2c.onion's password: 
data                                          100%  512KB  28.4KB/s   00:18    
root@debian:~# md5sum copy
81d52fca4cfe42dca24659850139672a  copy
$ cat hex 
$ xxd -r -p hex data
$ shasum -a 256 data >hash1
$ xxd -r -p hash1 bin
$ shasum -a 256 bin
e340423dffb20d7d21f17dfa272c527d84c20662061ce635627d0f0200000000  bin

Most Popular Tags


RSS Atom

June 2017

    1 23
Powered by Dreamwidth Studios