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

Jump to

Quick reference

svn basics, for git users

How to do stuff in subversion, when you're used to git:

# create a new branch
svn copy -m "Branching trunk" https://www.example.com/svn/repos/project/trunk https://www.example.com/svn/repos/project/branches/new_branch_name

# check out new branch
svn checkout https://www.example.com/svn/repos/project/branches/new_branch_name

# check status/diffs of working directory
svn status
svn diff

# show a specific commit
svn diff -c63197
svn diff -c63197 | vim -R -
svn diff -r63196:63197
svn diff -c63197 db/src/securesite/

# commit files
svn commit -m'Commit message' filename.ext

# see your changes after committing
svn update

# find where a branch was cut from trunk (svn equivalent of git mergebase)
# The last commit will be the first one in this branch after it was cut from trunk:
svn log -v --stop-on-copy

# cherry pick
svn merge -cXXXX trunk branch

# revert a commit
svn merge -c -REV .

Perl telnet script OR netcat

When you need to test using telnet, but don't have telnet installed, and you do have Perl:

use strict;
use warnings;

my $usage = "usage: $0 host port\n";

my $host = $ARGV[0] or die $usage;
my $port = $ARGV[1] or die $usage;

use Net::Telnet ();
my $t = new Net::Telnet (
        Port    => $port,
        Timeout => 5,
);
$t->open($host);

my $print_success = $t->print("GET / HTTP/1.0\n");
print "sent command: $print_success\n";

my @lines = $t->getlines(Timeout => 2);

print @lines;

OR an even easier way with netcat:

fprint "GET / HTTP/1.0\n\n" | nc host port

sudo doesn't list files properly

Problem:

You can list a directory using sudo:
$ sudo ls /var/log/apache/
access_log  error_log

But you can't list files with a wildcard using sudo:
$ sudo ls /var/log/apache/*_log
ls: cannot access /var/log/apache/*_log: No such file or directory

Solution:

Ensure parameter expansion happens in the shell run by sudo, not in the user's shell:
$ sudo bash -c 'ls /var/log/apache/*_log'

(source)

Test Kerberos authentication

vi /etc/krb5.conf
/opt/mitk5/bin/kinit [username]

Qemu console output

qemu-system-x86_64 -curses

No help here