Skip to content

Instantly share code, notes, and snippets.

View dhrp's full-sized avatar

Thatcher dhrp

View GitHub Profile
@dhrp
dhrp / gist:984b473f31cb2ae3da03
Created May 30, 2014 23:16
dashboard list html
<div id="starred_repos" class="listing_container span span4andahalf">
<div class="listing_header">Starred Repositories</div>
<ul class="listing">
<li>
<span class="listing_stars">4</span>
<a href="http://localhost:8000/u/joffrey/base/">joffrey/base</a>
</li>
64 bytes from 185.56.60.5: icmp_seq=180 ttl=44 time=159.052 ms
64 bytes from 185.56.60.5: icmp_seq=181 ttl=44 time=159.519 ms
64 bytes from 185.56.60.5: icmp_seq=182 ttl=44 time=161.176 ms
64 bytes from 185.56.60.5: icmp_seq=183 ttl=44 time=159.463 ms
64 bytes from 185.56.60.5: icmp_seq=184 ttl=44 time=174.466 ms
64 bytes from 185.56.60.5: icmp_seq=185 ttl=44 time=159.582 ms
64 bytes from 185.56.60.5: icmp_seq=186 ttl=44 time=159.328 ms
64 bytes from 185.56.60.5: icmp_seq=187 ttl=44 time=167.389 ms
64 bytes from 185.56.60.5: icmp_seq=188 ttl=44 time=159.291 ms
ping: sendto: Network is down
Request timeout for icmp_seq 29
Request timeout for icmp_seq 30
Request timeout for icmp_seq 31
Request timeout for icmp_seq 32
Request timeout for icmp_seq 33
Request timeout for icmp_seq 34
Request timeout for icmp_seq 35
Request timeout for icmp_seq 36
Request timeout for icmp_seq 37
Request timeout for icmp_seq 38
@dhrp
dhrp / run.sh
Created March 29, 2017 05:00
Entrypoint example of batch Dockerfile
#!/bin/sh
# Usage: $0 <inputfile.ext
#
# Program takes input from standard in, saves it
# and then lets PSSPred run with that inputfile
TMP_FILE=/tmp/input.txt
# Clean up the temp file
@dhrp
dhrp / gist:4ce9c5cd7f52921f77253333437e33d6
Created July 13, 2017 08:08
Logoutput Rancher failing with MySQL
core@p1 ~ $ docker logs rancher_server |more
CATTLE_AGENT_PACKAGE_HOST_API_URL=/usr/share/cattle/artifacts/host-api.tar.gz
CATTLE_AGENT_PACKAGE_PYTHON_AGENT_URL=/usr/share/cattle/artifacts/go-agent.tar.gz
CATTLE_API_UI_URL=//releases.rancher.com/api-ui/1.0.8
CATTLE_CATTLE_VERSION=v0.181.13
CATTLE_CLUSTER_ADVERTISE_ADDRESS=10.80.94.1
CATTLE_DB_CATTLE_DATABASE=mysql
CATTLE_DB_CATTLE_MYSQL_HOST=gcp-europe-west1-cpu.2.dblayer.com
CATTLE_DB_CATTLE_MYSQL_NAME=rancher_packet
CATTLE_DB_CATTLE_MYSQL_PORT=15554
@dhrp
dhrp / sqloutput
Created July 13, 2017 08:45
mysql variables
+----------------------------------------------------------+------------------------
| Variable_name | Value |
+----------------------------------------------------------+------------------------
| auto_increment_increment | 7
@dhrp
dhrp / count-to-600.yaml
Created November 9, 2017 17:10
job example
apiVersion: batch/v1
kind: Job
metadata:
name: count-to-600
spec:
parallelism: 3
completions: 6
activeDeadlineSeconds: 100
template:
metadata:
@dhrp
dhrp / message_too_long.log
Last active January 4, 2018 08:09
Snippet from log output showing "message too long" when a clear container is run.
findex: 14 Dst: 172.17.0.0/16 Src: 172.17.0.2 Gw: <nil> Flags: [] Table: 254} {Ifindex: 14 Dst: fe80::/64 Src: <nil> Gw: <nil> Flags: [] Table: 254}] {[] [] []}} false virtual}]" source=virtcontainers
Jan 03 22:36:43 c1.packet.nlze.nl cc-runtime[2819]: time="2018-01-03T22:36:43Z" level=warning msg="unsupported route" destination="fe80::/64" source=virtcontainers subsystem=hyper unsupported-route-type=ipv6
Jan 03 22:36:43 c1.packet.nlze.nl cc-runtime[2819]: time="2018-01-03T22:36:43Z" level=info msg="device details" container-id=cd368647d825506b58988a3d272e161ebfebee30ee1f2a10b8bd5c174175f903 device-major=0 device-minor=43 mount-point=/var/lib/docker/overlay2/2ae3c52795a42a65f116e57ef326538fc745b438a92f4e964cb43e8b992eff5d/merged pod-id=cd368647d825506b58988a3d272e161ebfebee30ee1f2a10b8bd5c174175f903 source=virtcontainers subsystem=container
Jan 03 22:36:43 c1.packet.nlze.nl cc-runtime[2819]: time="2018-01-03T22:36:43Z" level=info msg="Attaching block device" device=/dev/loop0 source=virtcontainers subsystem=
@dhrp
dhrp / main.go (partial)
Created February 21, 2018 15:23
Main function for grpc-gateway REST and gRPC muxed on a simgle port
func main() {
keyPair, certPool := certificates.GetCert()
grpcServer := makeGRPCServer(certPool)
restMux, err := getRestMux(certPool)
if err != nil {
log.Panic(err)
}
// register root Http multiplexer (mux)
@dhrp
dhrp / main.go
Created February 21, 2018 17:27
Function to destinguish between http and gRPC
// grpcHandlerFunc returns an http.Handler that delegates to grpcServer on incoming gRPC
// connections or otherHandler otherwise. Copied from cockroachdb.
func grpcHandlerFunc(grpcServer *grpc.Server, otherHandler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.ProtoMajor == 2 && strings.Contains(r.Header.Get("Content-Type"), "application/grpc") {
grpcServer.ServeHTTP(w, r)
} else {
otherHandler.ServeHTTP(w, r)
}
})