Skip to content

Instantly share code, notes, and snippets.

@kjmkznr
kjmkznr / Dockerfile
Created Jul 28, 2019
Mackerel Container Agent Image for ARM
View Dockerfile
FROM golang:alpine AS builder
RUN apk update && \
apk add --no-cache git ca-certificates && \
update-ca-certificates
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=arm
View dump.go
package main
import (
"bytes"
"flag"
"io"
"log"
"net/http"
"strconv"
)
View kube-flannel.yml
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: flannel
rules:
- apiGroups:
- ""
resources:
- pods
View decap-ipip.py
#!/usr/bin/env python3
from scapy.all import *
def decap_and_send(packet):
if packet[IP][0].proto == 4:
decap = (Ether() / packet[IP][1])
sendp(decap, iface='dummy0')
print(decap)
View oneliner.sh
>>> import base64
>>> import dnslib
>>>
>>> dnsmsg = 'f2+AgAABAAEAAAAAA3d3dwRyaXBlA25ldAAAAQABwAwAAQABAAA3+gAEwQAGiw=='
>>> dnslib.DNSRecord.parse(base64.b64decode(dnsmsg))
<DNS Header: id=0x7f6f type=RESPONSE opcode=QUERY flags=RA rcode='NOERROR' q=1 a=1 ns=0 ar=0>
<DNS Question: 'www.ripe.net.' qtype=A qclass=IN>
<DNS RR: 'www.ripe.net.' rtype=A rclass=IN ttl=14330 rdata='193.0.6.139'>
View 10-thinkpad.conf
Section "InputClass"
Identifier "Keyboard-ThinkPad"
Driver "libinput"
#MatchProduct "ThinkPad Compact Bluetooth Keyboard with TrackPoint"
#MatchIsKeyboard "on"
#Option "SendCoreEvents" "true"
Option "XkbLayout" "dvorak,us"
Option "XkbVariant" "dvorak"
Option "XkbOptions" "ctrl:swapcaps,grp:alt_shift_toggle,grp_led:scroll"
EndSection
View Dockerfile
FROM java:8
# SPARK
ARG SPARK_ARCHIVE=http://ftp.jaist.ac.jp/pub/apache/spark/spark-2.1.0/spark-2.1.0-bin-hadoop2.7.tgz
ENV SPARK_HOME /usr/local/spark-2.1.0-bin-hadoop2.7
ENV PATH $PATH:${SPARK_HOME}/bin
RUN curl -s ${SPARK_ARCHIVE} | tar -xz -C /usr/local/
WORKDIR $SPARK_HOME
View main.go
package main
import (
"bytes"
"flag"
"fmt"
"io"
"log"
"net/http"
"strconv"
View gist:40cb58e0c5542be503387625e4cfeb2d
$ go test -race
2016/10/05 14:58:28 S3 Bucket Cache Set - {"CacheItem":{"Timestamp":"2016-10-05T14:58:28.563142289Z","TTL":2000000000},"Name":"bucket_test_add","Location":"eu-west-1"}
2016/10/05 14:58:28 S3 Bucket Cache Hit - {"CacheItem":{"Timestamp":"2016-10-05T14:58:28.563142289Z","TTL":2000000000},"Name":"bucket_test_add","Location":"eu-west-1"}
2016/10/05 14:58:28 S3 Bucket Cache Set - {"CacheItem":{"Timestamp":"2016-10-05T14:58:28.56391918Z","TTL":2000000000},"Name":"bucket_test_expire","Location":"eu-west-1"}
2016/10/05 14:58:31 S3 Bucket Cache Miss - {"Name":"bucket_test_expire"}
2016/10/05 14:58:31 S3 Object Cache Miss - {"Key":"object_test_add"}
==================
--- FAIL: TestCacheObjectGet (0.00s)
WARNING: DATA RACE
Write at 0x00c4200814d0 by goroutine 10: