Skip to content

Instantly share code, notes, and snippets.

View ngerakines's full-sized avatar
🏠
Working from home

Nick Gerakines ngerakines

🏠
Working from home
View GitHub Profile
@ngerakines
ngerakines / keyping.go
Created February 7, 2019 16:47 — forked from zmanian/keyping.go
Key Pinning in #Golang
package main
import (
"bytes"
"crypto/sha256"
"crypto/tls"
"crypto/x509"
"log"
"net"
"net/http"
@ngerakines
ngerakines / memoize.erl
Created September 27, 2008 17:55
A small module to provide memoize functions in Erlang.
%% Copyright (c) 2008 Nick Gerakines <nick@gerakines.net>
%%
%% Permission is hereby granted, free of charge, to any person
%% obtaining a copy of this software and associated documentation
%% files (the "Software"), to deal in the Software without
%% restriction, including without limitation the rights to use,
%% copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the
%% Software is furnished to do so, subject to the following
%% conditions:

key pinning

  1. Use csplit to split the full chain.

    $ csplit -f cert- /etc/letsencrypt/live/path/to/fullchain.pem '/-----BEGIN CERTIFICATE-----/' '{*}'

  2. Get the hashes from the parts

    $ openssl x509 -noout -in cert-00 -pubkey | openssl rsa -pubin -outform der |openssl dgst -sha256 -binary | base64

ngerakines@eirena:~/development/ngerakines/menu$ ./menu create --artifact-id=menu-webapp --artifact-version=1.0.0 --artifact-location=file:///var/artifacts/com/socklabs/menu-webapp/menu-webapp-1.0.0.zip --cookbook=https://github.com/ngerakines/menu-webapp-cookbook
ngerakines@eirena:~/development/ngerakines/menu$ ls
1385576835.menu help.go LICENSE localfs.go menu menu.go model.go README.md
ngerakines@eirena:~/development/ngerakines/menu$ ./menu show file:////home/ngerakines/development/ngerakines/menu/1385576835.menu
path: file:////home/ngerakines/development/ngerakines/menu/1385576835.menu type: 1
time: 1385576835
artifacts:
menu-webapp 1.0.0 file:///var/artifacts/com/socklabs/menu-webapp/menu-webapp-1.0.0.zip
cookbooks:
https://github.com/ngerakines/menu-webapp-cookbook
11615-MBP15:menu nick.gerakines$ ./menu
Usage: menu <command> <arguments and options>
Commands:
create
show
artifacts
cookbooks
list
11615-MBP15:menu nick.gerakines$ ./menu create
func ok() {
}
func ok() {
}
#!/usr/bin/ruby
# WebExcursions, a script for gathering new Pinboard links with a certain tag
# and generating Markdown/Jekyll posts when enough are collected.
# Brett Terpstra 2013
#
# -f to force writing out current bookmarks to file regardless of count
%w[fileutils set net/https zlib rexml/document time base64 uri cgi stringio].each do |filename|
require filename
end
@ngerakines
ngerakines / main.cpp
Created January 16, 2013 18:07
tdd workshop stuff
// This is the test executable: where the tests will be declared and run.
#include "test.h"
#include <iostream>
#include <string>
#include <map>
#include <time.h>
using namespace std;

About

The maven-protobuff project contains a lightweight maven plugin used to compile proto files.

Features

  • Will automatically extract .proto files out of dependency jars and put them into “//target/protos”.
  • Will compile your module/project proto files into the “//src/main/java” directory for checkin.
  • Works with both standard and multi-module projects.
#include <Time.h>
int RFIDResetPin = 13;
//Register your RFID tags here
char tag1[13] = "84003378CA05";
char tag2[13] = "840033725D98";
char cat1name[5] = "Toby";
char cat2name[8] = "Biscuit";