Skip to content

Instantly share code, notes, and snippets.

@rothgar
rothgar / never.gif
Last active April 25, 2019 05:22
Never
never.gif
@rothgar
rothgar / install.sh
Created April 4, 2018 17:07
Code on Chromebook
#!/bin/sh
# Follow instructions here to enable dev mode and start VM
# https://github.com/lstoll/cros-crostini/blob/master/README.md
sudo apt-get update
sudo apt-get install -y libasound2 libxss1 wget
wget -qO- https://go.microsoft.com/fwlink/?LinkID=620884 | tar xvz
# Launch code
@rothgar
rothgar / wtf.sh
Created November 29, 2017 05:19
Linux server debugging in 60 seconds
#!/bin/bash
# Taken from https://medium.com/netflix-techblog/linux-performance-analysis-in-60-000-milliseconds-accc10403c55
# initialize array
COMMANDS=('uptime')
# add systemctl command if it's installed
command -v systemctl >/dev/null && COMMANDS+=('systemctl list-units --state=failed')
# add more commands
COMMANDS+=('dmesg | tail'
'vmstat 1'
@rothgar
rothgar / milti-container.pod.yaml
Created August 16, 2017 05:40
multi-container-pod example
apiVersion: "v1"
kind: Pod
metadata:
name: test
labels:
name: test
spec:
containers:
- name: nginx
image: nginx
@rothgar
rothgar / gist:5bbebfbd4b9f8e56f72bb991eae2f093
Last active June 13, 2017 17:47
nginx ingress differences
docker run --rm -it gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.7 nginx -V
nginx version: nginx/1.13.0
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
built with OpenSSL 1.0.2g 1 Mar 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run
/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-p
ath=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_mod
ule --with-http_geoip_module --with-http_gzip_static_module --with-http_sub_module --with-http_v2_module --with-stream --with-stream_ssl_mo
@rothgar
rothgar / Dockerfile.caddy
Created February 10, 2017 05:55
debugging go containers
FROM scratch
ADD caddy /
EXPOSE 2015
CMD ['/caddy']
I have run an nginx container...
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6d67de07731d nginx "nginx -g 'daemon ..." 40 minutes ago Up 40 minutes 80/tcp, 443/tcp epic_goldberg
I want to use strace for debug:
docker run -it --pid=container:6d67de07731d --net=container:6d67de07731d --cap-add sys_admin --cap-add sys_ptrace bash
I can see the nginx process:
@rothgar
rothgar / get-book.sh
Created February 3, 2017 17:40
Download Google SRE book for offline reading
#!/bin/bash
wget -r -nc -p --html-extension -k -D google.com -np https://landing.google.com/sre/book/
@rothgar
rothgar / coredns.yaml
Last active October 28, 2019 22:08
CoreDNS for Kubernetes
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
log stdout
health