Skip to content

Instantly share code, notes, and snippets.

@0sc
0sc / circle.yml
Created August 20, 2017 22:02
parallelising RSpec test
machine:
pre:
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
services:
- docker
dependencies:
override:
- sudo pip install --upgrade docker-compose
- docker build --rm=false -t project/image:ci .
database:
@0sc
0sc / docker-clean
Created September 7, 2017 09:58 — forked from pangpond/docker-clean
#!/bin/bash
# Copyright 2017 Théo Chamley
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
@0sc
0sc / aws-go+docker-setup.sh
Last active September 10, 2019 12:15
Setup script for golang, docker and docker-compose on Amazon Linux AMI 2017.09.0 (HVM) on EC2
#!bin/sh
# Update installed packages and package cache
sudo yum update -y
# make sure in the home folder
cd ~/
# Golang installation
@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
@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 / 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 / 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 / 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
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentd
namespace: kube-system
labels:
app: fluentd-logging
version: v1
kubernetes.io/cluster-service: "true"
spec:
apiVersion: v1
kind: ConfigMap
metadata:
name: fluentd-logging
namespace: kube-system
labels:
app: fluentd-logging
data:
fluent.conf: |
<source>