Skip to content

Instantly share code, notes, and snippets.

View dsolsona's full-sized avatar
:octocat:
What's happening?

Daniel Solsona dsolsona

:octocat:
What's happening?
  • Beekeeper
  • Basel
View GitHub Profile
@colmmacc
colmmacc / shardcalc.py
Last active August 7, 2023 11:05
Calculate the blast radius of a shuffle shard
import sys
# choose() is the same as computing the number of combinations. Normally this is
# equal to:
#
# factorial(N) / (factorial(m) * factorial(N - m))
#
# but this is very slow to run and requires a deep stack (without tail
# recursion).
#
@charity
charity / gist:d216810052c8cac23605
Created February 17, 2016 21:32
How to get all aws account limits.
$ for svc in $(aws list 3>&1 1>&2 2>&3 3>&- | sed -e '1,7d' |sed -e 's/\|//g') ; do aws $svc describe-account-attributes 2>/dev/null || echo "not supported for $svc" ; done
@vasanthk
vasanthk / System Design.md
Last active May 9, 2024 16:45
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@philandstuff
philandstuff / cfgmgmtcamp2016.org
Last active August 27, 2018 09:11
configuration management camp 2016 notes
#!/bin/bash
# This script creates a 128MB loopback file + device then puts
# dm-delay in front of it to cause all IOs to take >= 500ms.
bytes=$((2**27)) # 134217728 or 128MB
blocks=$(($bytes / 512)) # 262144
# create the loopback file
dd if=/dev/zero of=/srv/tmp.img bs=512 count=$(($blocks + 32))
@GABeech
GABeech / haproxy.cfg
Created August 21, 2014 18:35
Stack Exchange HAProxy
# This is an example of the Stack Exchange Tier 1 HAProxy config
# The only things that have been changed from what we are running are:
# 1. User names have been removed
# 2. All Passwords have been remove
# 3. IPs have been changed to use the example/documentation ranges
# 4. Rate limit numbers have been changed to randome numbers, don't read into them
userlist stats-auth
group admin users $admin_user
user $admin_user insecure-password $some_password
@chrisboulton
chrisboulton / makeitmakeitnow.sh
Created July 9, 2013 04:14
package nodejs using fpm (for debian) i'm lazy, you should be too, so here's a bash script.
#!/bin/bash
set -e
VERSION=0.10.12
BUILD_DIR=`mktemp -d`
trap "rm -rf -- $BUILD_DIR" EXIT
export DESTDIR=$BUILD_DIR/build
ARCHIVE=node-v$VERSION
@chrisboulton
chrisboulton / gist:5899714
Created July 1, 2013 10:06
swap mysql-5.1 out with percona-server-5.5 on a box with other packages depending upon mysql
# DISCLOSURE: it is a HORRIBLE, HORRIBLE idea for you to blindly run the
# below unless you absolutely know what each and every command does and
# have a system where you can test first, have appropriate backups etc.
# this is not a script - you should run every command and keep a very
# close eye on the output for anything unexpected.
apt-get install libaio1
apt-get install -d percona-server-client-5.5 percona-server-server-5.5 percona-server-server-5.5 libmysqlclient18=5.5.31-rel30.3-520.squeeze libmysqlclient-dev=5.5.31-rel30.3-520.squeeze
@josegonzalez
josegonzalez / access.lua
Created December 3, 2012 18:26
Simple lua file enabling oauth support for nginx via nginx-lua and access_by_lua.
- certain endpoints are always blocked
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then
ngx.exit(403)
end
-- import requirements
local cjson = require "cjson"
-- setup some app-level vars
local app_id = "APP_ID"
@josegonzalez
josegonzalez / nginx_release.sh
Last active October 11, 2019 15:46
Make an nginx release for ubuntu
#!/bin/bash
#####
# Builds a custom nginx
#
# RELEASE_TAGS="+your+tags+here"
# RELEASE_MAINTAINER="Your Name Here"
# RELEASE_MAINTAINER_EMAIL="hi@example.com"
# RELEASE_MESSAGE="Some message"
#