Skip to content

Instantly share code, notes, and snippets.

View kevinsimper's full-sized avatar

Kevin Simper kevinsimper

View GitHub Profile
kubectl get — no-headers secret | awk '{print $1}' | \
xargs -I{} sh -c 'kubectl get secret -o yaml "$1" > "$1.yaml"' — {}
@kevinsimper
kevinsimper / generate.js
Last active January 28, 2018 14:55
How to generate a list of all combinations with Javascript Generators
const letters = 'abcdefghijklmnopqrstuvxyzæøå'
const numbers = '0123456789'
const list = (letters + numbers).split('')
exports.generate = function* generate(length) {
function* gen(length) {
for(var i = 0; i < list.length; i++) {
if(length > 1) {
for (const val of gen(length - 1)) {
@kevinsimper
kevinsimper / removeserviceworkers.js
Last active January 22, 2018 13:38
Remove Serviceworkers
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then(function(registrations) {
for(let registration of registrations) {
registration.unregister()
}
})
}
@kevinsimper
kevinsimper / Dockerfile
Created June 19, 2017 17:51
Caddyserver
FROM alpine:latest
LABEL caddy_version="dev" architecture="amd64"
ENV GOPATH="/go"
EXPOSE 80 443 2015
ENTRYPOINT [ "/usr/bin/caddy" ]
0xD6Ab0A0f94C5E276051145F3C009C6E7CD75624A
@kevinsimper
kevinsimper / memory.sh
Created January 20, 2017 10:57
Find memory usage of Slack
ps -eo rss,comm | grep Slack | awk '{print $1}' | paste -s -d '+' - | bc | awk '{printf( "%0.2f GiB\n", $1/1024^2 )}'
ab -c 100 -n 100000 -T application/json -p data.json http://localhost:9000/collector
docker run -d --name elastic -p 9200:9200 elasticsearch
Check port 9200
docker run -d --name logstash -v $PWD/logstash:/etc/logstash/conf.d -v $PWD/test.log:/host/var/log/test.log --link elastic logstash logstash -f /etc/logstash/conf.d --debug
docker run -d --name kibana -p 5601:5601 --link elastic -e ELASTICSEARCH_URL=http://elastic:9200 kibana
test.log:
example
@kevinsimper
kevinsimper / readme.txt
Last active September 25, 2016 12:07
TMUX Cheatsheet
You need to run every command with Ctrl+b
## Split panes
Split horizontal: %
Split vertical: "
Close pane: x
## Pane navigation
Show numbers: q
Go to next pane: o
brew info hyper
hyper: stable 1.10 (bottled), HEAD
Client for the Hyper_ cloud service
https://hyper.sh
/usr/local/Cellar/hyper/1.10 (7 files, 11.3M) *
Poured from bottle on 2016-08-12 at 13:00:27
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/hyper.rb
==> Dependencies
Build: go ✘
kevinsimper@MacBook-Pro:[~/Projects/hyper-loadbalancer]: