Skip to content

Instantly share code, notes, and snippets.

$ grep -iHn poop netcat.c
netcat.c:94:struct host_poop {
netcat.c:99:#define HINF struct host_poop
netcat.c:101:struct port_poop {
netcat.c:106:#define PINF struct port_poop
netcat.c:143:HINF ** gates = NULL; /* LSRR hop hostpoop */
netcat.c:149:PINF * portpoop = NULL; /* for getportpoop / getservby* */
netcat.c:299: cross-check the host_poop we have so far against new gethostby*() info,
netcat.c:303:int comparehosts (poop, hp)
@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)
@acg
acg / unixlisten
Created December 18, 2013 03:09
Factoring out the listen(2) half of an ucspi unixserver.
#!/usr/bin/env python
'''
Like unixserver(1), but just listen and exec the subordinate program
with the listening socket as stdin. The subordinate program still needs
to call accept(2) on stdin.
'''
import sys
import os
import socket

Keybase proof

I hereby claim:

  • I am acg on github.
  • I am acg (https://keybase.io/acg) on keybase.
  • I have a public key ASDACiSbpawajMuFGCDc4pEUrKZlmefyKLfRtsZ7XmZp7wo

To claim this, I am signing this object:

@acg
acg / spam.js
Created April 27, 2016 17:50
Obfuscated Javascript Spam
var slothful = 0;
String.prototype.hotels = function () {
return this.replace("U","S").replace(":",".");
};
var tatata = "S";
String.prototype.hotels2 = function () {
return this.replace("R","c").replace("+","t").replace("3","veX");
};
var lll = +!![];
<html>
<head>
<style lang="text/css">
body {
margin: 0;
padding: 0;
}
@acg
acg / tsv2csv
Last active January 10, 2019 05:00
Convert tsv to csv with optional unescaping.
#!/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.tsv\n";
exit main( @ARGV );
@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 / delete-old-s3-markers.sh
Created August 25, 2021 23:16
Delete all old version markers in an S3 bucket. Be extremely careful!
#!/bin/sh
set -e
BUCKET="$1" ; shift
BATCH_SIZE=100
aws s3api list-object-versions --bucket "$BUCKET" |
jq '[.DeleteMarkers[] | {Key, VersionId}]' |
jq -c "_nwise($BATCH_SIZE) | {Objects:., Quiet:false}" |
@acg
acg / delete-old-s3-versions.sh
Last active August 25, 2021 23:17
Delete all old object versions in an S3 bucket. Be extremely careful!
#!/bin/sh
set -e
BUCKET="$1" ; shift
BATCH_SIZE=100
aws s3api list-object-versions --bucket "$BUCKET" |
jq '[.Versions[] | select(.IsLatest == false) | {Key, VersionId}]' |
jq -c "_nwise($BATCH_SIZE) | {Objects:., Quiet:false}" |