Skip to content

Instantly share code, notes, and snippets.

View simonhayward's full-sized avatar

Simon Hayward simonhayward

View GitHub Profile
@antirez
antirez / api.md
Last active November 20, 2018 02:52
Consumer groups final API
  • XGROUP CREATE <key> <groupname> <id or $>
  • XGROUP SETID <key> <id or $>
  • XGROUP DELGROUP <key> <groupname>
  • XGROUP DELCONSUMER <key> <consumername>
  • XPENDING <key> [<start> <stop>]
  • XCLAIM <key> <group-name> <consumer-name> <min-idle-time> <ID-1> <ID-2> ...
  • XACK <key> <ID-1> <ID-2> ...
  • XREAD-GROUP (wrapper for XREAD that accepts GROUP and CONSUMER options)
  • XINFO [CONSUMERS|GROUPS|STREAM|...]. STREAM is the default
@simonw
simonw / heroku-nginx-logging.md
Last active January 22, 2019 18:41
How to get Heroku to log full user_agent strings using nginx

How to get Heroku to log full user_agent strings using nginx

Heroku's default logging format omits user agent and referrer strings - but these are useful to have! Especially if you want to be able to run your own analysis on what kind of browsers are using your service.

A default Heroku log line looks like this:

heroku/router:  at=info method=GET path="/page-on-your-site/"

host=your-site.herokuapp.com

@jbeda
jbeda / nar-spec.md
Created September 1, 2015 23:04
Nix Archive (NAR) file specification

This is taken directly from Figure 5.2 in http://nixos.org/~eelco/pubs/phd-thesis.pdf. It is presented here to be more directly linkable.

serialise(fso) = str("nix-archive-1") + serialise1(fso)

serialise1(fso) = str("(") + seralise2(fso) + str(")")

serialise2(type=Regular, exec, contents) =
  str("type") + str("regular")
 + (
@ipmb
ipmb / ratelimit.nginxconf
Last active May 26, 2024 13:57
Nginx reverse proxy with rate limiting
upstream myapp {
server 127.0.0.1:8081;
}
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s;
server {
listen 443 ssl spdy;
server_name _;
@igrigorik
igrigorik / micro-openssl-perf.sh
Created December 15, 2013 18:54
EC2 micro instance in EC2 West...
ubuntu@ip-10-202-152-39:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
stepping : 7
microcode : 0x70a
cpu MHz : 1799.999
cache size : 20480 KB
@digitaljhelms
digitaljhelms / gist:3099010
Created July 12, 2012 15:58
Squash the first two commits in a git repository's history

The scenario

Your repository has two commits:

$ git log --oneline
957fbfb No, I am your father.
9bb71ff A long time ago in a galaxy far, far away....