Skip to content

Instantly share code, notes, and snippets.

View richieforeman's full-sized avatar
😻

Richie Foreman richieforeman

😻
View GitHub Profile
@richieforeman
richieforeman / tracing_token_example.java
Last active January 8, 2016 16:33
Google API Tracing Token - Java
//// First, Implement an interface to intercept the HTTP Request before it goes out.
import java.io.IOException;
import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
import com.google.api.client.googleapis.services.GoogleClientRequestInitializer;
public class TracingTokenInitializer implements GoogleClientRequestInitializer {
@Override
public void initialize(AbstractGoogleClientRequest<?> req) throws IOException {
System.out.println("Attaching tracing token...");
req.put("trace", "token:<<TOKEN GOES HERE>>");
@richieforeman
richieforeman / sample.pac
Last active June 13, 2026 23:57
Sample PAC File for Google Apps Deployments
function FindProxyForURL(url, host) {
// Plain hostnames. ( e.g. http://server )
if (isPlainHostName(host)) {
return "DIRECT";
}
// Private address classes.
if (isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0") ||
@richieforeman
richieforeman / list_compare.py
Created October 31, 2012 16:57
Compare two simple files and return the differences
import sys
import os
def read_file(f, split="\n"):
return open(f).read().split(split)
list1 = read_file(sys.argv[1])
list2 = read_file(sys.argv[2])
@richieforeman
richieforeman / makeauthority.sh
Created July 23, 2012 21:38
Issue Your Own Self-Signed S/MIME Certs with OpenSSL
# Run this once
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt