Skip to content

Instantly share code, notes, and snippets.

@larryli
larryli / rsa-pkcs.go
Last active September 12, 2020 07:51
RSA SignPKCS1v15 and VerifyPKCS1v15
// rsa-pkcs [-hash sha1] [-key id_rsa] -sign "foobar"
// rsa-pkcs [-hash sha1] [-pub id_rsa.pub] -verify "sign_data" "foobar"
package main
import (
_ "code.google.com/p/go.crypto/md4"
_ "code.google.com/p/go.crypto/ripemd160"
"crypto"
_ "crypto/md5"
@larryli
larryli / rsa-sign-and-verify.go
Created January 9, 2014 12:15
RSA sign/verify
package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"errors"
"os"
// GOARCH=arm GOOS=linux GOCHAR=5 go build -ldflags "-s -w" -o github-webhook-pull.cgi github-webhook-pull.go
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/http/cgi"
"os"
@larryli
larryli / cgi.go
Last active March 5, 2024 17:14
golang net/http/cgi example
// go build -ldflags "-s -w" -o index.cgi cgi.go
package main
import (
"fmt"
"net/http"
"net/http/cgi"
)
@larryli
larryli / shadowsocks-local.conf
Created October 31, 2013 11:58
shadowsocks-local service configuration of upstart
# ~/.config/upstart/shadowsocks-local.conf
description "ShadowSocks Local Service"
author "Larry Li <larryli@qq.com>"
# start/stop/restart/status shadowsocks-local
start on starting xsession-init
exec ~/bin/shadowsocks-local -c=~/bin/config.json
@larryli
larryli / gist:4587210
Created January 21, 2013 16:26
fix brew php-mcrypt bug
brew cleanup
brew remove mcrypt
rm /usr/local/etc/php/5.3/conf.d/ext-mcrypt.ini
brew install mcrypt