Skip to content

Instantly share code, notes, and snippets.

View mwhudson's full-sized avatar

Michael Hudson-Doyle mwhudson

View GitHub Profile
#!/usr/bin/perl -w
use strict;
use Dpkg::Control;
my @args;
my $target = "ubuntu";
my $changes;
my $dryrun = 0;
@mwhudson
mwhudson / mro.py
Created April 18, 2017 04:37
even more pathological python
class T(type):
def mro(cls):
global C
C = cls
return []
try:
T("T", (), {})
except TypeError:
pass
mwhudson@aeglos:~$ cat mro.py
class T(type):
def mro(self):
return []
class X(object,metaclass=T):
pass
class Y(object):
pass
#!/bin/sh
DATE="$(TZ=UTC date +"%Y%m%d" -d "@$(git log -1 --pretty=format:%ct)")"
HASH="$(git log -n 1 "--format=format:%h")"
VERSION="0.0~git${DATE}.0.${HASH}"
PKG="$1"
ORIG="${PKG}_${VERSION}.orig.tar.gz"
package main
import (
"debug/elf"
"encoding/binary"
"fmt"
"io"
"log"
"os"
)
? golang.org/x/text [no test files]
ok golang.org/x/text/cases 0.380s
? golang.org/x/text/cmd/gotext [no test files]
--- FAIL: TestProcessWeights (0.00s)
collate_test.go:222: 4: Weights 1 was 2684357122; want 2684354560
collate_test.go:222: 5: Weights 1 was 2684354570; want 2684354560
collate_test.go:222: 11: Weights 1 was 2684357122; want 2684354560
collate_test.go:222: 12: Weights 1 was 2684354570; want 2684354560
collate_test.go:222: 18: Weights 1 was 2684357122; want 2684354560
collate_test.go:222: 19: Weights 1 was 2684354570; want 2684354560
@mwhudson
mwhudson / shlibify
Last active May 30, 2016 01:08
script for converting go packages to build a shared library
#!/usr/bin/perl
package main;
use strict;
use warnings;
use Cwd qw(:DEFAULT abs_path);
use Dpkg::Control;
use Dpkg::Control::Info;
ok archive/tar 0.030s
ok archive/zip 60.159s
ok bufio 0.125s
ok bytes 9.558s
ok compress/bzip2 0.116s
ok compress/flate 38.625s
ok compress/gzip 0.130s
ok compress/lzw 0.128s
ok compress/zlib 2.255s
ok container/heap 0.087s
package main
import (
"encoding/json"
"fmt"
yaml "gopkg.in/yaml.v2"
)
type bar struct {