Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
#set -o xtrace
set -o errexit
set -o pipefail
set -o nounset
bin="$(cd "$(dirname "$0")" > /dev/null; pwd)"
longrunning() {
@dcapwell
dcapwell / use.sh
Last active January 12, 2018 02:23
Usage, Saturation, Errors checklist script
#!/usr/bin/env bash
##
## Script is a automation for collecting metrics that represent (U)sage, (S)aturation, and (E)rrors (USE).
## This script is mostly automating [1], so more details can be found there
##
## References
## * [1] http://www.brendangregg.com/USEmethod/use-linux.html
##
@dcapwell
dcapwell / git-remove.sh
Created October 23, 2017 23:21
Git remove file from history
git filter-branch --index-filter 'git update-index --remove path/to/file/in/git'
// pre-create nodes so its easier to link them together
// add n to first nodes just to make the loop simple
Node[] nodes = new Node[targetLevel + 1];
nodes[0] = n;
for (int i = 1; i <= targetLevel; i++)
nodes[i] = new Node(value, null, nodes[i - 1]);
Classfile /home/dcapwell/src/github/prototypes/kotlin-collections/build/kotlin-classes/main/com/github/dcapwell/kotlin/collections/ConsList$size$1.class
Last modified Sep 17, 2016; size 1976 bytes
MD5 checksum fe97807c3d0ade285d2790eb907e3b39
Compiled from "ConsList.kt"
final class com.github.dcapwell.kotlin.collections.ConsList$size$1 extends kotlin.jvm.internal.Lambda implements kotlin.jvm.functions.Function2<com.github.dcapwell.kotlin.collections.ConsList<A>, java.lang.Integer, java.lang.Integer>
minor version: 0
major version: 50
flags: ACC_FINAL, ACC_SUPER
Constant pool:
#1 = Utf8 com/github/dcapwell/kotlin/collections/ConsList$size$1
//fun <A> nil(): ConsList<A> {
// return ConsList.Nil<A>
//}
sealed class ConsList<A> : Iterable<A> {
fun cons(value: A): ConsList<A> {
return Cons(value, this);
}
module Tracker where
---- MODEL ----
type alias Dashboard =
{ name : String
, active : Bucket
, pending : Bucket
, icebox : Bucket }
@dcapwell
dcapwell / jvm.monitor
Last active June 22, 2020 23:47
Java JVM monitor
# https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jstat.html
# eden (free), old (free), young GC time, # full GC, full GC time, total GC time
jstat -gc -h10 $(jps -m | grep <process name here> | awk '{print $1}') 1000 0 | awk '/^[0-9]/ {printf "%-10s %-10s %-10s %-10s %-10s %-10s\n", int((100*$6)/$5), int((100*$8)/$7), $(NF-3), $(NF-2), $(NF-1), $NF}'
# OR
pid=42
jstat -gc -h10 $pid 1000 0 | awk '/^ [0-9]/ {printf "%-10s %-10s %-10s %-10s %-10s %-10s\n", int((100*$6)/$5), int((100*$8)/$7), $(NF-3), $(NF-2), $(NF-1), $NF}'
@dcapwell
dcapwell / boot2docker-use-nfs.sh
Created August 20, 2015 06:03
NFS for boot2docker
#!/usr/bin/env bash
set -x
#
# This script will mount /Users in the boot2docker VM using NFS (instead of the
# default vboxsf). It's probably not a good idea to run it while there are
# Docker containers running in boot2docker.
#
# Usage: sudo ./boot2docker-use-nfs.sh
package tach_demo;
import java.net.InetSocketAddress;
import tachyon.org.apache.thrift.TProcessor;
import tachyon.org.apache.thrift.server.TServer;
import tachyon.org.apache.thrift.server.TThreadedSelectorServer;
import tachyon.org.apache.thrift.transport.TNonblockingServerSocket;
import tachyon.org.apache.thrift.transport.TTransportException;