This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# Memoize function persistently | |
# klg, Feb 2014 | |
use strict; | |
use warnings 'all'; | |
use Storable qw/freeze thaw/; | |
use Compress::Zlib; | |
use Fcntl ':flock'; | |
sub pmemz($&) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# CRC32 preimage with fixed prefix/suffix. | |
# klg, Feb 2014 | |
use strict; | |
# CRC32 table | |
my @crc_table; | |
for my $n (0 .. 255) { | |
my $c = $n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Analyze GZIP header for anything unusual, -v to print the usual too. | |
# klg, Dec 2013 | |
use strict; | |
use constant GZIP_ID => 0x8b1f; | |
use constant { | |
FLG_FTEXT => (1 << 0), | |
FLG_FHCRC => (1 << 1), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# Analyze header of CRX packages (Chrome extensions). | |
# klg, Feb 2014 | |
use strict; | |
use open IO => ':bytes'; | |
use Digest::SHA 'sha256_hex'; | |
use MIME::Base64; | |
use Crypt::OpenSSL::RSA; | |
use constant CRX_MAGIC => 0x34327243; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected]) | |
# The author disclaims copyright to this source code. | |
import sys | |
import struct | |
import socket | |
import time | |
import select |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% echo "I'm late to the party :( -- [email protected]" | openssl sha1 -sign server.key -sha1 | openssl enc -base64 | |
GebyG5i9chR3KftgifswQELVMhxK+CzuKp/gXb8K9nAtNu7i/Vz9pv28PaxOLRUd | |
jotryjgjvwB1T4lGkUBF+3eVvTP9xlQ7lgT6jvm1JEGsFMT806uLWAgWh7YVnzhm | |
H8r1exl7mCYWeYvmR6YgVk9ImUbTRmMwt1XX39M6IDiw9o3Rss9txAURwdDoECjK | |
coaBhrS6LwWqh1Tm2TfnywjuAUTUZnqeuLyj1UoYjfy+yneofhl8W7FmD0hiAp+v | |
9SmGJvVAoY1peJbdYKQ9us8jJMuMs+75be2/erNMCdHAZWOD8QnaliE5dNZrlwiY | |
QkHBqNtaes1ti2y/fCzOcA== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dnl The Game of Life in POSIX macro processor M4 | |
dnl klg, Apr 2014 | |
dnl | |
divert(-1) | |
define(`local',`pushdef(`$1',`$2')`'$3`'popdef(`$1')') | |
define(`silent', | |
`local(`__divnum',divnum,`divert(-1)$*`'divert(__divnum)')') | |
define(`for',`ifelse(eval(`$2'<`$3'),`1',dnl | |
`local(`$1',`$2',`$4')`'$0(`$1',incr(`$2'),`$3',`$4')')') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# Store in GZIP (RFC 1952) format uncompressed. | |
# klg, May 2014 | |
use strict; | |
use open ':std', IO => ':bytes'; | |
use Compress::Zlib 'crc32'; | |
push @ARGV, '-' if $#ARGV < 0; | |
for my $file (@ARGV) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# klg, May 2014 | |
import fontconfig | |
import sys | |
chars = list(''.join(sys.argv[1:])) | |
if not len(chars): | |
sys.exit(0) | |
fonts = fontconfig.query() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "gophernicus.h" | |
#include <assert.h> | |
int main() { | |
int shmid; | |
shm_state *shm; | |
shmid = shmget(SHM_KEY, sizeof(shm_state), 0); | |
assert(shmid != -1); | |
shm = shmat(shmid, NULL, 0); | |
assert(shm != (void*) -1); |