Skip to content

Instantly share code, notes, and snippets.

View cdemers's full-sized avatar

Charle Demers cdemers

  • Wellington & King, Inc.
  • Montreal
  • 08:57 (UTC -05:00)
View GitHub Profile
package main
import (
"log"
"sync"
)
func main() {
inChan := make(chan workToDo, 2)
@cdemers
cdemers / kshell.sh
Created August 7, 2019 00:02
Shell script to be used to simplify opening a shell in a container within a pod in a Kubernetes cluster.
#!/bin/sh
# Using this script you simply have to specify the first letters of a pod
# to open a shell, the default shell is bash, but you can specify an
# alternative as second parameter.
#
# For example, if you have the two following pods:
# - caching-service-blablabla-123123-abcdef
# - creditcard-frontend-blabla-3213213-fghijk
#
@cdemers
cdemers / pug_html_links_and_script.md
Last active July 3, 2019 02:51
PUG (HTML) Inclusions that I use all the time, with integrity checksum enabled

Keybase proof

I hereby claim:

  • I am cdemers on github.
  • I am cdemers (https://keybase.io/cdemers) on keybase.
  • I have a public key ASDVS79mHfFJuq8OzyLaFavILYUSFglM0mfCxQbin4J6ygo

To claim this, I am signing this object:

@cdemers
cdemers / not_sourced_detection.bash
Created August 3, 2017 18:56
Warning for scripts that should be sourced, instead of executed.
[[ $_ == $0 ]] && echo "This script should probably be sourced."
@cdemers
cdemers / install_awscli.sh
Last active October 30, 2017 22:24
Installing awscli on Mac OS X El Capitan (System Integrity Protection workaround)
#!/bin/sh
# OSX El Capitan _System Integrity Protection_ workaround
sudo -H pip install awscli --ignore-installed six
# With OSX, it's likely you will need to upgrade pip eventually
sudo -H pip install --upgrade pip
@cdemers
cdemers / ar_and_xz_reader.go
Created May 4, 2017 15:59
Sample code to read content from a .deb file in Go
package main
import (
"archive/tar"
"bytes"
"io"
"log"
"os"
"github.com/blakesmith/ar"
@cdemers
cdemers / format_float.go
Created January 18, 2017 03:24
Go (golang) float formatting WITHOUT rounding
s := fmt.Sprintf("%.4f", 10/6.0)[0:5]
@cdemers
cdemers / CoreOS_install_socat.sh
Last active September 14, 2017 19:08
Install the socat binary into a CoreOS installation
# Insightful instructions, originally posted by Xynova (https://github.com/xynova)
# Make socat directories
mkdir -p /opt/bin/socat.d/bin /opt/bin/socat.d/lib
# Create socat wrapper
cat << EOF > /opt/bin/socat
#! /bin/bash
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/bin
LD_LIBRARY_PATH=/opt/bin/socat.d/lib:$LD_LIBRARY_PATH exec /opt/bin/socat.d/bin/socat "\$@"
@cdemers
cdemers / spinner.go
Last active March 15, 2017 14:26
Quicky spinner Go (golang) code using the nice briandowns' spinner library
import "github.com/briandowns/spinner"
someSillySet := []string{"🐶", "🐱", "🐭", "🐹", "🐰", "🐻", "🐼", "🐨", "🐯", "🦁"}
s := spinner.New(someSillySet, 100*time.Millisecond)
// or
s := spinner.New(spinner.CharSets[9], 75*time.Millisecond)
s.Start()
defer s.Stop()