Skip to content

Instantly share code, notes, and snippets.

View AGWA's full-sized avatar

Andrew Ayer AGWA

View GitHub Profile
@AGWA
AGWA / name_constrain.go
Last active December 3, 2015 04:28
Go program to add name constraints to a certificate
/*
* Adds name constraints to a certificate. Useful if you need to
* import your organization's private CA into your web browser, but
* you only want to trust it for your organization's domains and not
* the Internet at large.
*
* The certificate is re-signed by an ephemeral issuer with a random
* key so you don't need access to the private key. A random serial number
* is placed in the Issuer DN so browsers don't attempt to verify the
* signature when you import the certificate.
@AGWA
AGWA / readlink.cpp
Last active October 8, 2015 13:47
C++ readlink wrapper
@AGWA
AGWA / PKGBUILD
Created May 12, 2015 05:32
Fixed PKGBUILD for git-crypt
pkgname=git-crypt
pkgver=0.4.2
pkgrel=1
pkgdesc="Transparent file encryption in Git"
arch=('i686' 'x86_64')
url="https://www.agwa.name/projects/${pkgname}/"
license=('GPL3')
depends=('git' 'openssl')
provides=("$pkgname")
conflicts=("${pkgname}-git")
@AGWA
AGWA / apt.diff
Created September 23, 2014 17:38
Diff between apt-0.9.7.9+deb7u4 and apt-0.9.7.9+deb7u5
diff -ru _1/apt-0.9.7.9+deb7u4/apt-pkg/acquire-item.cc _2/apt-0.9.7.9+deb7u5/apt-pkg/acquire-item.cc
--- _1/apt-0.9.7.9+deb7u4/apt-pkg/acquire-item.cc 2014-09-17 07:30:35.000000000 -0700
+++ _2/apt-0.9.7.9+deb7u5/apt-pkg/acquire-item.cc 2014-09-22 23:56:57.000000000 -0700
@@ -970,6 +970,12 @@
else
Local = true;
+ // do not reverify cdrom sources as apt-cdrom may rewrite the Packages
+ // file when its doing the indexcopy
+ if (RealURI.substr(0,6) == "cdrom:" &&
@AGWA
AGWA / migrate-revamp-key.cpp
Created July 5, 2014 19:11
Tool to migrate a git-crypt revamp branch key
// Migrate an old-style git-crypt revamp branch key to a new-style git-crypt revamp branch key.
// Reads old key from stdin and writes new key to stdout.
// Compile with: c++ -o migrate-revamp-key migrate-revamp-key.cpp
#include <iostream>
#include <cstdlib>
#include <cstring>
static void grab (char* p, std::streamsize len)
{