Skip to content

Instantly share code, notes, and snippets.

@acg
acg / csv2tsv
Created April 4, 2013 17:14
Convert csv to tsv with optional escaping.
#!/usr/bin/env perl
use Text::CSV;
use Getopt::Long qw/ GetOptionsFromArray :config pass_through /;
use warnings;
use strict;
my $usage = "usage: $0 [-e] < file.csv\n";
exit main( @ARGV );
@acg
acg / tcplisten
Created December 5, 2012 01:22
Factoring out the listen(2) half of djb's tcpserver.
#!/usr/bin/env python
import sys
import os
import socket
port = sys.argv.pop(0)
host = sys.argv.pop(0)
port = int(sys.argv.pop(0))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)