Skip to content

Instantly share code, notes, and snippets.

Jason Stangroome jstangroome

Block or report user

Report or block jstangroome

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jstangroome
jstangroome / install.sh
Created Apr 13, 2019
WSL useful extra packages
View install.sh
apt-get install -y \
apt-transport-https \
binutils \
build-essential \
python-pip \
socat \
sysstat \
traceroute \
unzip \
zip
View find-long-commit-messages.sh
#!/bin/bash
while read -r commit_hash
do
message=$(
git cat-file commit "${commit_hash}" |
sed '1,/^$/d'
)
if [ "${message:0:5}" = 'Merge' ] || [ "${message:0:6}" = 'Revert' ]
@jstangroome
jstangroome / collect_usage_in_bytes.sh
Created Jan 2, 2019
Create a CSV of each cgroup's memory.usage_in_bytes and some related memory.stat values.
View collect_usage_in_bytes.sh
#!/bin/bash
printf '%s,%s,%s,%s,%s,%s,%s,%s\n' \
'dir' 'usage_in_bytes' \
'cache' 'total_cache' \
'rss' 'total_rss' \
'rss_huge' 'total_rss_huge'
cd /sys/fs/cgroup/memory/
View collect_usage_in_bytes.sh
#!/bin/bash
printf '%s,%s,%s,%s,%s,%s,%s,%s\n' \
'dir' 'usage_in_bytes' \
'cache' 'total_cache' \
'rss' 'total_rss' \
'rss_huge' 'total_rss_huge'
cd /sys/fs/cgroup/memory/
@jstangroome
jstangroome / script.sh
Created Aug 21, 2018
Rewrite your Windows .kube/config to be usable by Linux kubectl inside WSL
View script.sh
#!/bin/bash
win_profile_dir=$(wslpath "$(cmd.exe /c "echo %USERPROFILE%" | tr -d '\r')")
win_dot_kube_dir="${win_profile_dir}/.kube"
win_kube_config="${win_dot_kube_dir}/config"
wsl_dot_kube_dir="${HOME}/.kube"
View minikube-docker-env-wsl.bash
#!/bin/bash
if [ "$_" = "${BASH_SOURCE}" ]
then
printf 'source this script, do not execute.\n' >&2
exit 1
fi
eval $(minikube docker-env --shell bash)
if [ -n "${DOCKER_CERT_PATH}" ] && [ "${DOCKER_CERT_PATH:0:1}" != '/' ]
View pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: example
spec:
initContainers:
- name: file-copy
image: busybox:latest
command:
- cp
@jstangroome
jstangroome / docker-readme
Last active May 24, 2018
Container memory limits as visible to container process
View docker-readme
# docker 17.12.1-ce
=> docker run
==> /sys/fs/cgroup/memory/memory.kmem.limit_in_bytes <==
18446744073709551615
==> /sys/fs/cgroup/memory/memory.kmem.tcp.limit_in_bytes <==
18446744073709551615
==> /sys/fs/cgroup/memory/memory.limit_in_bytes <==
18446744073709551615
@jstangroome
jstangroome / dpkg.sh
Created Mar 21, 2018
Default packages present on a Rackcorp Ubuntu 16.04 x64 install as at 2018-MAR-21
View dpkg.sh
$ dpkg --list
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===========================-==================-==================-============================================================
ii accountsservice 0.6.40-2ubuntu11.3 amd64 query and manipulate user account information
ii adduser 3.113+nmu3ubuntu4 all add and remove users and groups
ii apt 1.2.26 amd64 commandline package manager
ii apt-utils 1.2.26 amd64 package management related utility programs
@jstangroome
jstangroome / Dockerfile
Created Mar 20, 2018
Build lslocks for Ubuntu Trusty
View Dockerfile
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get build-dep --assume-yes \
util-linux
RUN apt-get install --assume-yes \
wget \
gnupg
You can’t perform that action at this time.