Skip to content

Instantly share code, notes, and snippets.

View SkamDart's full-sized avatar
👻
Too Spooky

Cameron SkamDart

👻
Too Spooky
View GitHub Profile
@SkamDart
SkamDart / latency.txt
Created March 9, 2019 08:10 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@SkamDart
SkamDart / run.sh
Created March 4, 2019 19:46
execute bash command for each input using xargs
monkeytype list-modules | xargs -n 1 monkeytype apply
@SkamDart
SkamDart / find_image.sh
Created November 2, 2018 19:12
shell image tag match
#
kubectl get cronjobs | awk '{print $1}' | xargs kubectl describe cronjob | grep 'IMAGE_TAG'
# count number of cronjobs with provided IMAGE_TAG
kubectl get cronjobs | awk '{print $1}' | xargs kubectl describe cronjob | grep 'IMAGE_TAG' | wc -l
@SkamDart
SkamDart / delete_crons.sh
Created October 19, 2018 17:36
one liner delete all cronjobs with name
kubectl get cronjob | grep 'jobprefix' | awk '{print $1}' | xargs kubectl delete cronjob
@SkamDart
SkamDart / k8_delete.sh
Created September 19, 2018 16:52
batch delete kubernetes jobs
kk get pods | grep 'job-name-' | awk '{print $1}' | xargs kubectl delete pods
# Copyright 2018 Cameron Dart
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
@SkamDart
SkamDart / gist:5dd14cc667b409df3d4523fb159bc866
Created June 11, 2018 04:22
my mac install script. this is completely untested
# Copyright 2018 Cameron Dart
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
@SkamDart
SkamDart / find_deps.py
Created May 9, 2018 01:16
Determines which modules are used by a python script
from modulefinder import ModuleFinder
import sys
def print_dependencies(filename):
f = ModuleFinder()
f.run_script(filename)
names = list(f.modules.keys())
basemods = sorted(set([name.split(".")[0] for name in names]))
print("\n".join(basemods))
@SkamDart
SkamDart / perf.sh
Created April 29, 2018 23:49
spimbot perf
#!/usr/bin/env bash
for i in $(seq 1 10); do (QtSpimbot -randommap -run -exit_when_done -maponly -quiet -f spimbot.s 2>/dev/null >> out.log &); done