Skip to content

Instantly share code, notes, and snippets.

@andrewschaaf
andrewschaaf / gist:871082
Created March 15, 2011 17:25
node sign/verify test
###
openssl genrsa 4096 > x.pem
openssl req -new -key x.pem -out x.csr
openssl x509 -req -days 365 -in x.csr -signkey x.pem -out x.crt
###
test = (private_key, cert) ->
@justincormack
justincormack / nginx.conf
Created April 29, 2011 14:57
Using Lua and Nginx to proxy Amazon web services example
# example location parts of nginx.conf
# add your own AWS keys, server lines etc, and set your aws domains, paths
http {
# you will need the luacrypto in the cpath, download from http://luacrypto.luaforge.net/
lua_package_cpath "/home/justin/lua/luacrypto-0.2.0/src/l?.so.0.2.0;;";
server {
listen 80;
@hostmaster
hostmaster / nginx.conf
Created March 7, 2012 11:19
nginx post-action
location ^~ /attachments/download_zip/ {
proxy_pass http://mongrel;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X_Forwarded_Proto $scheme;
proxy_read_timeout 120;
proxy_connect_timeout 120;
post_action @notify_zip
@kylelemons
kylelemons / client.go
Created April 4, 2012 19:59
Server and client RPC benchmarks
package main
import (
"net/rpc"
"fmt"
"sync"
. "testing"
)
@nosolopau
nosolopau / s3.js
Last active May 4, 2017 08:53
Amazon S3 upload policy generation with JavaScript (Node.js).
var crypto = require("crypto");
var moment = require("moment")
var s3 = {
generateS3Policy: function (fileName) {
var s3Policy = {
'conditions': [
{'bucket': CONF.s3.bucket},
['starts-with', '$key', 'uploads/' + fileName],
{'acl': 'public-read'},
@siddontang
siddontang / hmac.lua
Created May 18, 2013 09:24
openresty string hmac implementation
local ffi = require "ffi"
local sha512 = require "resty.sha512"
local aes = require "resty.aes"
local ffi_new = ffi.new
local ffi_str = ffi.string
local C = ffi.C
local setmetatable = setmetatable
local error = error
@plentz
plentz / nginx.conf
Last active June 9, 2024 13:18
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@debasishg
debasishg / gist:8172796
Last active May 10, 2024 13:37
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
@praseodym
praseodym / AESGCMUpdateAAD2.java
Last active May 13, 2024 10:20
JDK8 AES-GCM code example
import javax.crypto.*;
import javax.crypto.spec.GCMParameterSpec;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import java.util.Arrays;
public class AESGCMUpdateAAD2 {
// AES-GCM parameters
public static final int AES_KEY_SIZE = 128; // in bits
@jonhoo
jonhoo / README.md
Last active July 19, 2021 10:49
Distributed RWMutex in Go