Skip to content

Instantly share code, notes, and snippets.

@waleedsamy
waleedsamy / authdardization.md
Last active November 23, 2016 11:44
auth and authz
  • ceneterlized authentication and authorization server.
  • simple interface to configure clients permision.
  • permision changes should propagated immediately e.g. api_rate_limit
  • no username/password send throw wires, tokens instead
  • token is generated using secret keys, which change automtically. whithout effecting any client
  • should use the right application and have the right permission to do anything
  • no need to hit auth server everytime you need to check the permission of your client rfc7519
  • no more than 25ms for doing authentication, is it to low?
  • easy use solution, proivide shared libraries(based in your programming language to use)
@waleedsamy
waleedsamy / release.sh
Last active December 8, 2016 11:33
merge and push branches - designed to release nodejs applications
#!/usr/bin/env bash
###
## install: curl https://gist.githubusercontent.com/waleedsamy/6a8a214ade791a4df60777336328206f/raw/5fd0d9bbdcc2deaf3d023fcf8b682ea24350baa6/release.sh > ~/release.sh && chmod +x ~/release.sh
## usage: ~/release.sh
## usage: ~/release.sh master stable
## depends on: https://gist.github.com/waleedsamy/921294a0e5bdd49cf4c4
###
usage(){
@waleedsamy
waleedsamy / iptables-save.sh
Created September 15, 2016 13:17
save iptable to file with name like iptables-20160915151528
iptables-save > /root/iptables-$(date +"%Y%m%d%H%M%S")
# iptables-restore < /root/iptables-20160915151528
@waleedsamy
waleedsamy / Dockerfile
Last active September 9, 2016 07:35
Kubernetes Cluster TLS using OpenSSL
FROM centurylink/openssl
apk add --update curl bash vim tree
echo "PS1='\w\$ '" >> ~/.bashrc && \
source ~/.bashrc && cd
curl https://raw.githubusercontent.com/coreos/coreos-kubernetes/master/lib/init-ssl-ca > ~/init-ssl-ca && \
chmod +x ~/init-ssl-ca
@waleedsamy
waleedsamy / publish.sh
Created August 2, 2016 06:53
parallel deploy in cluster after splitting it's machines to make sure if something go wrong, there will be a running instances in some servers
#!/usr/bin/env bash
# should have your public key added in every machine server
user=deploybot
servers=(127.18.34.122 127.18.34.123 127.18.34.124 127.18.34.125 127.18.34.126 127.18.34.127 127.18.34.128 127.18.34.129 127.18.34.130)
count=${#servers[@]}
deploy(){
cluster=("$@")
@waleedsamy
waleedsamy / .gitconfig
Created July 13, 2016 07:35
my ~/.gitconfig file
[user]
name = Waleed Samy
email = waleedsamy634@gmail.com
[core]
editor = vim
[push]
default = matching
[sendemail]
smtpserver = smtp.gmail.com
smtpserverport = 587
@waleedsamy
waleedsamy / fixup.txt
Created June 29, 2016 08:17 — forked from lucasdavila/fixup.txt
Fixing mac os yosemite issue "bash: fork: Resource temporarily unavailable"
# see the current limits
$ sysctl -a | grep maxproc
# increase it
$ sudo sysctl -w kern.maxproc=xxxx
$ sudo sysctl -w kern.maxprocperuid=xxx
# run at startup
$ sudo vim /etc/sysctl.conf
@waleedsamy
waleedsamy / PackageJsonVersion.sh
Last active June 6, 2017 16:43
build docker image with same version as docker container, based on [this](https://gist.github.com/DarrenN/8c6a5b969481725a4413)
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
docker build -t apps/app:latest -t apps/app:v$PACKAGE_VERSION .
@waleedsamy
waleedsamy / bnch.sh
Last active June 15, 2016 13:12
apache/siege benchmark
ab -k -r -c 500 -n 1000 172.18.34.122:8080/ && \
siege -c500 -d10 -t1M 172.18.34.122:8080/
@waleedsamy
waleedsamy / ab.rb
Last active June 12, 2016 15:59 — forked from kylewlacy/ab.rb
Apache Bench Homebrew Formula
# Based on https://github.com/simonair/homebrew-dupes
# That repo seems to be dead, and I don't really feel like making a pull request.
require 'formula'
class Ab < Formula
homepage 'http://httpd.apache.org/docs/trunk/programs/ab.html'
url 'http://mirror.23media.de/apache//httpd/httpd-2.4.20.tar.bz2'
sha1 'cefe8ea4a3f81c7a08e36c80ebbd792c67ab361b'
depends_on 'libtool' => :build