Skip to content

Instantly share code, notes, and snippets.

View dblackdblack's full-sized avatar

David Black dblackdblack

  • Benchling
  • San Francisco
View GitHub Profile
#!/bin/bash -xe
do_kube() {
result=$(kubectl --kubeconfig ${KUBECONFIG} --context ${KUBECONTEXT} $cmd)
echo "$result"
}
for ns in $(cmd='get ns -l=istio-injection -o jsonpath="{.items[*].metadata.name}' do_kube) ; do
cmd="rollout restart deployment -n $ns" do_kube
cmd="rollout restart statefulsets -n $ns" do_kube
Step 3/13 : RUN mkdir /src && cd /src && git clone --recurse-submodules --branch=v0.5.0 https://github.com/jaegertracing/jaeger-client-cpp.git && cd /src/jaeger-client-cpp && ./scripts/build-plugin.sh
---> Running in 304651a141c7
Cloning into 'jaeger-client-cpp'...
Note: checking out '68be4e2d0416bc7b7262ff7111efa9cc1c5a2d08'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
@dblackdblack
dblackdblack / gist:9a76ff490f3d48743bc787764d210d52
Created March 18, 2020 20:21
macos docker ssh agent forward
docker run -v /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock \
--env SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock \
ubuntu
@dblackdblack
dblackdblack / a.py
Last active March 17, 2020 01:04
covid scraper
import logging
import json
import requests
import collections
import socket
datadog_host = '127.0.0.1'
datadog_port = 8125
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
logging.basicConfig(level=logging.INFO)
events {
worker_connections 1024;
accept_mutex off;
use epoll;
}
http {
# include more useful numbers in nginx log lines
# https://www.nginx.com/blog/using-nginx-logging-for-application-performance-monitoring/
# https://superuser.com/a/1060873
map $http_x_forwarded_for $allowed {
default false;
~(^|,|\s)54.68.161.228$ true;
~(^|,|\s)10.200.\d+.\d+$ true;
"" true; # for internal-to-internal traffic, X-Forwarded-For is unset
}
server {
#!/bin/bash
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@dblackdblack
dblackdblack / gist:8d0585fee1ae815aa4a34db4a587a053
Last active December 15, 2016 19:30
spinnaker close_waits
#!/bin/bash
for i in clouddriver fiat echo gate orca igor front50 ; do
mainpid=$(sudo systemctl show -p MainPID ${i}.service | cut -d= -f2)
javapid=$(pgrep -lP $mainpid | grep java | awk '{print $1}')
closewaits=$(sudo lsof -p $javapid | grep IPv6 | wc -l)
msg="tcp.close_wait:${closewaits}|g|#app:$i"
echo $msg
echo $msg > /dev/udp/localhost/8125
done
echo hello | openssl aes-256-cbc -k secret123 -a | openssl aes-256-cbc -k secret123 -d -a
@dblackdblack
dblackdblack / redis_lock.sh
Created September 22, 2016 14:56
A script which acquires uses redis to ensure exactly one server runs a process
#!/bin/bash -e
set -e
# a script which acquires an exclusive lock from a redis server
# and executes a command that needs mutual exclusion across servers
# usage:
# redis_lock.sh <lock_name> <command>
redis_server=redis.example.com