Skip to content

Instantly share code, notes, and snippets.

@rothgar
rothgar / tmate-compile.sh
Created January 19, 2017 07:03
Compile tmate on centos 7
#!/bin/bash
set -e
yum install -y epel-release
yum makecache
yum install -y @development git cmake ruby zlib-devel openssl-devel libevent-devel ncurses-devel libssh-devel msgpack-devel
git clone https://github.com/nviennot/tmate.git
@rothgar
rothgar / kubeadm.sh
Last active January 21, 2017 04:19
kubeadm
#!/bin/bash
#from a fresh install of centos 7 (after running yum update and rebooting)
#run as root
set -e
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
setenforce 0
systemctl disable --now firewalld
@rothgar
rothgar / microbot.ing.yaml
Created January 4, 2017 06:06
microbot ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: microbot-ingress
spec:
rules:
- host: microbot
http:
paths:
- path: /
@rothgar
rothgar / numa-maps-summary.pl
Created January 2, 2017 07:53
numa-maps-summary
#!/usr/bin/perl
# Copyright (c) 2010, Jeremy Cole <jeremy@jcole.us>
# This program is free software; you can redistribute it and/or modify it
# under the terms of either: the GNU General Public License as published
# by the Free Software Foundation; or the Artistic License.
#
# See http://dev.perl.org/licenses/ for more information.
@rothgar
rothgar / Dockerfile
Created July 21, 2016 15:09
kubectl pod
FROM scratch
LABEL BUILD_CMD="docker build -t docker-registry:5000/kubernetes/kubectl:v1.3.0"
# Put your kubectl binary in the local folder
ADD kubectl /
ENTRYPOINT ["/kubectl"]
@rothgar
rothgar / incognito.sh
Created June 28, 2016 14:55
incognito shell function
#!/bin/bash
incognito() {
if [[ -z ${SHELL} ]]; then
echo "Could not determin shell.\nUsing /bin/bash"
SHELL=bash
fi
case "${SHELL}" in
*bash)
set -o history
;;
# ping once per minute. Every minute for a day
ping -i 60 -c 1440 google.com | grep loss | awk -F ',' '{print $3}'
# print avg latency (ms) per hour. One ping per minute
ping -i 60 -c 60 google.com | awk '{print $8}' | sed -n '/^time/p' | awk -F '=' '{print $2}' | awk '{ sum += $1 } END { if (NR > 0) print sum / NR }'
@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 / dev_k8s.sh
Created March 29, 2016 04:47
local dev kubernetes server
# stolen from http://www.charliedrage.com/kubernetes-dev-in-one-command
dev_k8s(){
local choice=$1
K8S_VERSION=1.2.0
if [ ! -f /usr/bin/kubectl ] && [ ! -f /usr/local/bin/kubectl ]; then
echo "No kubectl bin exists! Install the bin to continue :)."
return 1
fi
@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}