Skip to content

Instantly share code, notes, and snippets.

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentd
namespace: kube-system
labels:
app: fluentd-logging
version: v1
kubernetes.io/cluster-service: "true"
spec:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: pinger-monitor
labels:
app: pinger
prometheus: prom-op
spec:
selector:
matchLabels:
FROM golang:1.12-stretch AS builder
WORKDIR $GOPATH/pinger
COPY . .
RUN go build -o app .
FROM ubuntu:bionic
COPY --from=builder /go/pinger/app /
ENV PORT=8000
EXPOSE $PORT
apiVersion: v1
kind: ConfigMap
metadata:
name: fluentd-logging
namespace: kube-system
labels:
app: fluentd-logging
data:
fluent.conf: |
<source>
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentd
namespace: kube-system
labels:
app: fluentd-logging
version: v1
kubernetes.io/cluster-service: "true"
spec:
@0sc
0sc / encrypt_decrypt.rb
Created January 12, 2018 16:12
Simple encrypt decrypt strings in ruby
require 'openssl'
def encrypt_string(str)
cipher_salt1 = 'some-random-salt-'
cipher_salt2 = 'another-random-salt-'
cipher = OpenSSL::Cipher.new('AES-128-ECB').encrypt
cipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(cipher_salt1, cipher_salt2, 20_000, cipher.key_len)
encrypted = cipher.update(str) + cipher.final
encrypted.unpack('H*')[0].upcase
end
@0sc
0sc / main.go
Created January 4, 2018 01:03 — forked from husobee/main.go
simple golang http middleware chaining example
package main
import (
"fmt"
"net/http"
"time"
"golang.org/x/net/context"
"github.com/husobee/backdrop"
@0sc
0sc / sicuro-sample-subscribe-webhook.go
Created December 30, 2017 01:44
Sample sicuro code snippet for creating a webhook on a repo
...
client := github.NewClient(nil)
hook := github.Hook{
Name: github.String("web"),
Active: &active,
Events: []string{"push", "pull_request"},
Config: map[string]interface{}{
"content_type": "json",
"url": "http://localhost/our/webhook/callback/url",
"secret": "some-security-token",
@0sc
0sc / Dockerfile
Created December 29, 2017 23:38
sicuro-ci ruby dockerfile
FROM ubuntu:16.04
# packages required for building rubies with rvm
RUN apt-get update -qqy && apt-get install -qqy \
bzip2 \
gawk \
g++ \
gcc \
make \
libreadline6-dev \
@0sc
0sc / anyclosedfile.go
Created October 27, 2017 10:39
Checks and returns true/false if there's any closed file (i.e not open file) in the given directory. anyclosedfile.In('/abs/path/to/dir')
package anyclosedfile
import (
"log"
"os"
"os/exec"
"path/filepath"
)
// In checks the given directory for files that are not being actively written to