A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

irc bots

Infobot!

# karma
[name]++ # [reason]
[name]-- # [reason]
explain [name]

# concepts
[concept]?
[concept] is [explanation]
no, [concept] is [explanation]
[concept] is [suggestion]
[concept] is also [alternative explanation]

Perl: Subtract one list from another list

my @difference = grep { not ($_ ~~ \@small_array) } @big_array;


# ~~ is the smart matching operator

Easily create graphs from code

Use graphviz:

1) write graph code

digraph g{
  Opened[label="1\nOpened\nE: open door"];
  Closed[label="2\nClosed\nE: closed door"];
  node[shape=plaintext];

  Opened -> close_door[arrowhead=none];
  close_door -> Closed;
  Opened -> open_door[dir=back];
  open_door -> Closed[arrowhead=none];
}


2) generate graph

dot -Tjpg -ograph.jpg graph.dot

3) view graph


You can easily store the source code to the graph in version control.
Don't forget to also store the instructions to rebuild it.