Skip to content

Instantly share code, notes, and snippets.

@xydinesh
xydinesh / multiple-url-paths.lua
Created March 25, 2020 22:43 — forked from anonymous/multiple-url-paths.lua
Benchmark multiple url paths with wrk
-- Resource: https://github.com/timotta/wrk-scripts/blob/master/multiplepaths.lua
-- Initialize the pseudo random number generator
-- Resource: http://lua-users.org/wiki/MathLibraryTutorial
math.randomseed(os.time())
math.random(); math.random(); math.random()
-- Shuffle array
-- Returns a randomly shuffled array
function shuffle(paths)
@xydinesh
xydinesh / kubernetes_add_service_account_kubeconfig.sh
Created November 8, 2019 04:18 — forked from innovia/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@xydinesh
xydinesh / rust-in-large-organizations-notes.md
Created September 4, 2019 21:03 — forked from rylev/rust-in-large-organizations-notes.md
Rust in Large Organizations Notes

Rust in Large Organizations

Initially taken by Niko Matsakis and lightly edited by Ryan Levick

Agenda

  • Introductions
  • Cargo inside large build systems
  • FFI
  • Foundations and financial support
@xydinesh
xydinesh / sed.txt
Created August 21, 2019 18:03 — forked from shreeshga/sed.txt
sed quick help guide
HANDY ONE-LINERS FOR SED (Unix stream editor) Oct. 29, 1997
compiled by Eric Pement <epement@jpusa.chi.il.us> version 4.3
Latest version of this file is always at <http://www.wollery.demon.co.uk>
FILE SPACING:
# double space a file
sed G
# triple space a file
sed 'G;G'
@xydinesh
xydinesh / netrw.txt
Created May 23, 2019 21:08 — forked from danidiaz/netrw.txt
Vim's netrw commands.
--- ----------------- ----
Map Quick Explanation Link
--- ----------------- ----
< <F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file |netrw-cr|
<del> Netrw will attempt to remove the file/directory |netrw-del|
<c-h> Edit file hiding list |netrw-ctrl-h|
<c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
<c-r> Browse using a gvim server |netrw-ctrl-r|
<c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
@xydinesh
xydinesh / vimrc
Created September 15, 2018 22:16
syntax on
filetype plugin indent on
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
@xydinesh
xydinesh / k8s-svc-annotations.md
Created June 8, 2018 22:45 — forked from mgoodness/k8s-svc-annotations.md
AWS ELB-related annotations for Kubernetes Services (v1.5)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-timeout (in seconds)
@xydinesh
xydinesh / nginx-osrm.conf
Last active February 1, 2018 22:11
Nginx configuration for revers proxy osrm backend
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@xydinesh
xydinesh / nginx.conf
Created February 1, 2018 22:01 — forked from bsergean/nginx.conf
Simple nginx.conf file
#
# Run in the foreground locally
# nginx -p . -c nginx.conf
#
worker_processes 1;
daemon off;
error_log nginx_error.log;
events {
worker_connections 1024;
@xydinesh
xydinesh / nginxproxy.md
Created January 25, 2018 00:40 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers