Skip to content

Instantly share code, notes, and snippets.

@elarib
elarib / dump-configmaps.sh
Last active October 24, 2023 19:10
Dump all kubernetes secrets configmaps to yaml files
NAMESPACE=YOUR_NAMESPACE_HERE && \
kubectl -n $NAMESPACE get --no-headers configmaps | awk '{print $1}' | \
xargs -I {} sh -c "kubectl -n $NAMESPACE get configmaps {} -o yaml > {}.yaml"
@raviagheda
raviagheda / github-action-ssh.md
Last active July 1, 2024 15:32
Github Action with EC2 using SSH
@yanniszark
yanniszark / split_yaml.go
Created April 15, 2020 11:54
Golang: Multiple YAML Documents / Split YAML
import goyaml "github.com/go-yaml/yaml"
func SplitYAML(resources []byte) ([][]byte, error) {
dec := goyaml.NewDecoder(bytes.NewReader(resources))
var res [][]byte
for {
var value interface{}
err := dec.Decode(&value)
@agrinman
agrinman / magic_link_login.go
Last active May 2, 2024 10:31
A quick Golang code sample for using ApproveAPI to send a magic login link.
@pramsey
pramsey / 0-spatial-sql-postgis.md
Last active November 13, 2023 18:33
Spatial SQL and PostGIS
@bivihoba
bivihoba / Dockerfile
Created October 13, 2017 09:02
Potrace Sandbox Dockerfile
FROM alpine:3.6
RUN apk add --no-cache --update gcc make automake autoconf libtool musl-dev zlib-dev git openssl nodejs nodejs-npm imagemagick
RUN git clone https://github.com/skyrpex/potrace.git && \
cd potrace && \
autoreconf -i && \
./configure && make && make install
RUN npm install -g svgo
@james2doyle
james2doyle / getXML.go
Last active March 29, 2024 07:08
Use HTTP to GET and parse XML in golang
// tweaked from: https://stackoverflow.com/a/42718113/1170664
func getXML(url string) ([]byte, error) {
resp, err := http.Get(url)
if err != nil {
return []byte{}, fmt.Errorf("GET error: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return []byte{}, fmt.Errorf("Status error: %v", resp.StatusCode)
@huyinghuan
huyinghuan / encrypt_file_pkcs5_pkcs7.go
Created May 31, 2017 07:44
golang encrypt with pkcs5 and pkcs7
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"errors"
"io"
"io/ioutil"
@kaspergrubbe
kaspergrubbe / geonames_postgres.rb
Last active April 4, 2024 08:12
Import files from Geonames.com into a PostgreSQL database that runs Postgis
#!/usr/bin/env ruby
require 'open3'
require 'fileutils'
def run_command(command)
puts("+: " + command)
Open3.popen2e(command) do |stdin, stdout_stderr, wait_thread|
Thread.new do
stdout_stderr.each {|l| puts l }

I have been an aggressive Kubernetes evangelist over the last few years. It has been the hammer with which I have approached almost all my deployments, and the one tool I have mentioned (shoved down clients throats) in almost all my foremost communications with clients, and it was my go to choice when I was mocking my first startup (saharacluster.com).

A few weeks ago Docker 1.13 was released and I was tasked with replicating a client's Kubernetes deployment on Swarm, more specifically testing running compose on Swarm.

And it was a dream!

All our apps were already dockerised and all I had to do was make a few modificatons to an existing compose file that I had used for testing before prior said deployment on Kubernetes.

And, with the ease with which I was able to expose our endpoints, manage volumes, handle networking, deploy and tear down the setup. I in all honesty see no reason to not use Swarm. No mission-critical feature, or incredibly convenient really nice to have feature in Kubernetes that I'm go