Skip to content

Instantly share code, notes, and snippets.

@dhrp
dhrp / shell-log
Created Mar 23, 2021
Resizing a volume on OpenStack and making it available in your machine
View shell-log
Oswald:authentication thatcher$ os volume list
+--------------------------------------+--------------------------------------------------------------------------------------------+-----------+------+-------------------------------------------------------+
| ID | Name | Status | Size | Attached to |
+--------------------------------------+--------------------------------------------------------------------------------------------+-----------+------+-------------------------------------------------------+
| f04e5683-6a67-4208-b4b4-9c6d544d41db | | in-use | 20 | Attached to wireguard-vpn on /dev/vda |
+--------------------------------------+--------------------------------------------------------------------------------------------+--------
@dhrp
dhrp / main.go
Created Mar 11, 2020
Main file to build rancher/machine/drivers/openstack
View main.go
package main
// This file is simply to build the rancher openstack driver.
// it's for the latest openstack (train) as we're using at GreenEdge
// It is required because the openstack driver is otherwise included
// by default in the docker-machine binary.
// Simply put it somewhere, and build it with
// go build -o docker-machine-driver-greenedge and then use it like
// docker-machine create --driver greenedge [etc]
@dhrp
dhrp / docker-compose.yaml
Created Nov 8, 2018
docker-compose file to reproduce the error.
View docker-compose.yaml
version: "3"
services:
geth:
container_name: configurator_api
image: dhrp/aws_gethdaemon:source
command:
- "--nodiscover"
- "--peer-table-name"
- "eth-auto-EthereumCommonStack-YUOAW65KR29A-EthereumECSStack-G0RBZQHB26EZ-DynamoPeerTable-XSXJRR6DAIOV"
@dhrp
dhrp / container_inspect.json
Created Nov 8, 2018
Docker inspect AWS geth daemon output
View container_inspect.json
[
{
"Id": "be730673bb1ed2db8160a116dc707e3eb72c1542c749b084ad1bb5f15a8b075c",
"Created": "2018-11-08T12:48:44.750070611Z",
"Path": "/usr/bin/node",
"Args": [
"/opt/geth-daemon/build/index.js",
"--nodiscover",
"--peer-table-name",
"eth-auto-EthereumCommonStack-YUOAW65KR29A-EthereumECSStack-G0RBZQHB26EZ-DynamoPeerTable-XSXJRR6DAIOV",
@dhrp
dhrp / createUiDefinition.json
Last active Jul 4, 2018
createuidefinition
View createUiDefinition.json
{
"handler": "Microsoft.Compute.MultiVm",
"version": "0.0.1-preview",
"parameters": {
"basics": [
{
"name": "adminUsername",
"type": "Microsoft.Compute.UserNameTextBox",
"label": "VM username",
"toolTip": "Administrative username for the virtual machines.",
@dhrp
dhrp / main.go
Created Feb 21, 2018
Function to destinguish between http and gRPC
View main.go
// 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)
}
})
@dhrp
dhrp / main.go (partial)
Created Feb 21, 2018
Main function for grpc-gateway REST and gRPC muxed on a simgle port
View main.go (partial)
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 / message_too_long.log
Last active Jan 4, 2018
Snippet from log output showing "message too long" when a clear container is run.
View message_too_long.log
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=
View count-to-600.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: count-to-600
spec:
parallelism: 3
completions: 6
activeDeadlineSeconds: 100
template:
metadata:
@dhrp
dhrp / sqloutput
Created Jul 13, 2017
mysql variables
View sqloutput
+----------------------------------------------------------+------------------------
| Variable_name | Value |
+----------------------------------------------------------+------------------------
| auto_increment_increment | 7