Skip to content

Instantly share code, notes, and snippets.

@flox1an
flox1an / default.conf
Last active September 1, 2023 07:26
nginx config that uses the oauth2-proxy (via auth_request) to authenticate against gitlab and then proxies all requests to a backend service while setting the auth headers X-User and X-Email
server {
listen 80;
server_name localhost;
location /oauth2/ {
proxy_pass http://oauth-proxy:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Auth-Request-Redirect $request_uri;
@arun-gupta
arun-gupta / readme.adoc
Last active January 15, 2020 03:54
Using Amazon CNI with kops-created Kubernetes cluster

AWS CNI plugin is now merged with kops: kubernetes/kops#3997. This gist explains how to build kops, create a Kubernetes cluster using correct --networking option, and then test it.

Build kops

export GOPATH=`pwd`
mkdir src/k8s.io; cd src/k8s.io
git clone git@github.com:kubernetes/kops.git
cd kops
export S3_BUCKET_NAME=<some bucket you own>
@mshkrebtan
mshkrebtan / webex-ubuntu.md
Last active October 28, 2022 15:23
Run Cisco Webex on 64-bit Ubuntu 16.04

Run Cisco Webex on 64-bit Ubuntu 16.04

With Audio and Screen Sharing Enabled

Enable support for 32-bit executables

Add the i386 architecture to the list of dpkg architectures :

sudo dpkg --add-architecture i386

kops cluster config

kubeAPIServer:
  authorizationMode: RBAC
  authorizationRbacSuperUser: admin
  oidcCAFile: /srv/kubernetes/ca.crt
  oidcClientID: example
  oidcGroupsClaim: groups
  oidcIssuerURL: https://dex.example.com
  oidcUsernameClaim: email
@sg-s
sg-s / automatic-version-numbers.md
Last active March 3, 2024 10:07
Automatic version numbers of your git repository using git hooks

Put this in a file called pre-commit in .git/hooks/

#!/bin/sh
# To enable this hook, rename this file to "pre-commit".

git rev-list --count master > build_number
git add build_number
@dm0-
dm0- / kernel-small.md
Last active July 30, 2019 19:53
Build a modified CoreOS kernel (no initramfs modules; X260 driver notes)

Download and start the CoreOS development image in a container. Make sure to bind writable directories over the kernel's build and install paths.

wget 'http://alpha.release.core-os.net/amd64-usr/current/coreos_developer_container.bin.bz2'
bzcat coreos_developer_container.bin.bz2 > coreos_developer_container.bin
mkdir boot modules src
sudo systemd-nspawn \
    --bind="$PWD/boot:/boot" \
    --bind="$PWD/modules:/lib/modules" \

--bind="$PWD/src:/usr/src" \

Why I prefer CLI over UI ?

  • CLI tools are Composable using pipes (great old school example http://www.youtube.com/watch?v=tc4ROCJYbm0&t=5m32s)
  • Great for automation and batch processing
  • Fewer mouse clicks. Can go futher using only keyboard
  • Avoid cluky UIs especially over poor connections
  • I'm insulated from UI changes
  • Easier to debug as they are often more verbose than the UI
@htp
htp / curl-websocket.sh
Last active April 25, 2024 14:57
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@kmjones1979
kmjones1979 / nginx.conf
Last active January 18, 2024 17:25
Example NGINX configuration using auth_request and auth_request_set directives to route users
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
default_type text/html;
log_format main '$remote_addr -> $request $status $body_bytes_sent bytes -> $upstream_addr';
access_log /var/log/nginx/access.log main;
@olih
olih / jq-cheetsheet.md
Last active May 2, 2024 00:42
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq