Skip to content

Instantly share code, notes, and snippets.

View jimcadden's full-sized avatar

Jim Cadden jimcadden

  • Boston, MA
View GitHub Profile
@jimcadden
jimcadden / get_ips_of_docker_service.sh
Last active October 17, 2017 19:57
Get container IPs of a Docker service
my_serv=$1
net_id=$(docker service inspect --format '{{.Endpoint.VirtualIPs}}' $my_serv | cut -c 3- | cut -d ' ' -f 1)
net_name=$(docker network inspect --format '{{.Name}}' $net_id)
docker service ps --format '{{.ID}} {{.Node}}' $my_serv |
while read serv_id node_id;
do
cont_id=$(docker inspect --format '{{.Status.ContainerStatus.ContainerID}}' $serv_id 2> /dev/null)
node_ip=$(docker node inspect $node_id --format '{{ .Status.Addr }}' 2> /dev/null)
cont_ip=$(docker -H $node_ip inspect --format '{{index .NetworkSettings.Networks "'$net_name'" "IPAddress"}}' $cont_id 2> /dev/null)
title date reveal_theme reveal_transition reveal_transitionSpeed reveal_slideNumber
EbbRT+NodeJS (Unikernel 7/11/17)
2017-07-12
sky
slide
fast
false

Constructing Per-Application Operating Systems

du -h --max-depth=1 $HOME 2>/dev/null | grep '[0-9\.]\+G'
@jimcadden
jimcadden / gist:726eda693d6b0a42b916
Created September 11, 2015 15:50
pthread round-robin affinity
static int current_cpu = -1;
int max_cpus = 8 * sizeof(cpu_set_t);
cpu_set_t m;
CPU_ZERO(&m);
sched_getaffinity(0, sizeof(cpu_set_t), &m);
for (int i = 0; i < max_cpus; ++i) {
int c = (current_cpu + i + 1) % max_cpus;
if (CPU_ISSET(c, &m)) {
CPU_ZERO(&m);
CPU_SET(c, &m);
@jimcadden
jimcadden / gist:ad89bf65bee756e455c9
Last active August 29, 2015 14:22
SOCKS ssh proxy forwarder
#commandline
ssh -o ProxyCommand='nc -x localhost:5000 %h %p ' {destination}
#~/.ssh/config
ProxyCommand ssh {destination} -W %h:%p
@jimcadden
jimcadden / gist:7102941
Created October 22, 2013 15:38
pedantic dnsmasq
dnsmasq -z --dhcp-range=192.168.0.50,192.168.0.199,255.255.255.0 --interface=tap100 --except-interface=lo --listen-address=192.168.0.3
-dhcp-range=<start>,<end>,<mask>
-listen-address=<ip of interface>
@jimcadden
jimcadden / git log visualizer (command line)
Created June 6, 2012 15:21
git log visualizer for command line
git config --global alias.lg 'log --all --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset" --abbrev-commit'