Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / circle.yml
Last active March 12, 2017 11:44
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-compose.yml
Created March 12, 2017 11:36
parallelising RSpec test with docker
version: '2'
services:
feature_tests:
image: project/image:ci
container_name: features_tests
command: bash -c "service postgresql start; sleep 1m; xvfb-run -a rspec spec/features"
controller_tests:
image: project/image:ci
container_name: controller_tests
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-tutorial
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
backend:
serviceName: default-http-backend
servicePort: 80
@0sc
0sc / ingress.yaml
Created January 8, 2017 18:01
Ingress deployment for simple auth tutorial
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: simple-auth-ingress
spec:
backend:
serviceName: default-http-backend
servicePort: 80
rules:
- host: simple-auth.me
@0sc
0sc / simple-auth.cr
Created January 8, 2017 16:35
Main code for handling google oauth request for k8tes tutorial
require "http/client"
require "./simple-auth/*"
module Simple::Auth
macro default_layout_view_for(view)
render "src/views/#{{{view}}}.ecr", "src/views/layouts/default.ecr"
end
get "/" do
default_layout_view_for "index"
@0sc
0sc / manifest.yml
Created September 11, 2016 18:10
bluemix tutorial sample manifest.yml file
applications:
- path: .
memory: 256M
instances: 1
domain: eu-gb.mybluemix.net
name: bluemix-blog
host: bluemix-blog
disk_quota: 1024M
command: rake db:migrate && bin/rails server -p $PORT -e $RAILS_ENV
services:
topic := "topic-to-subscribe-to" //e.g. user-created-topic
partitionList := consumer.Partitions(topic) //get all partitions
messages := make(chan *sarama.ConsumerMessage, 256)
initialOffset := sarama.OffsetOldest //offset to start reading message from
for _, partition := range partitionList {
pc, _ := consumer.ConsumePartition(topic, partition, initialOffset)
go func(pc sarama.PartitionConsumer) {
for message := range pc.Messages() {
messages <- message //or call a function that writes to disk
}