Skip to content

Instantly share code, notes, and snippets.

@rothgar
rothgar / never.gif
Last active April 25, 2019 05:22
Never
never.gif
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 / systemd_sysvinit.md
Last active November 5, 2018 01:51
Systemd vs SysVinit

Services

action sysvinit systemd
start service service foo start systemctl start foo[.service]
stop service service foo stop systemctl stop foo[.service]
restart service service foo restart systemctl restart foo[.service]
reload service service foo reload systemctl reload foo[.service]
service status service foo status systemctl status foo[.service]
restart if running service foo condrestart systemctl condrestart foo[.service]
@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 / 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 / gist:7131900
Created October 24, 2013 05:37
Ansible one liners
###Deploy SSH key to ansible inventory###
for server in $(ansible --list-hosts all); do ssh-copy-id -i ~/.ssh/id_rsa.pub $server; done
@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 / formatted
Last active June 24, 2017 10:03 — forked from marcellodesales/formatted.sh
One-liner REST server using netcat - nc
rm -f out
mkfifo out
trap "rm -f out" EXIT
while true
do
cat out | nc -l 1500 > >( # parse the netcat output, to build the answer redirected to the pipe "out".
export REQUEST=
while read line
do
line=$(echo "$line" | tr -d '[\r\n]')
@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 / static_build.sh
Last active May 3, 2017 07:50 — forked from aauren/static_build.sh
Create Static Build of the_silver_searcher
#!/bin/bash
PCRE_VERSION="8.38"
XZ_UTILS_VERSION="5.2.2"
AG_VERSION="0.31.0"
PCRE_URL="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${PCRE_VERSION}.tar.gz"
XZ_URL="http://tukaani.org/xz/xz-${XZ_UTILS_VERSION}.tar.gz"
AG_URL="http://geoff.greer.fm/ag/releases/the_silver_searcher-${AG_VERSION}.tar.gz"
WORK_DIR="${TMPDIR:-/var/tmp/}"
pushd ${WORK_DIR}