Skip to content

Instantly share code, notes, and snippets.

View cdemers's full-sized avatar

Charle Demers cdemers

  • Wellington & King, Inc.
  • Montreal
  • 08:53 (UTC -04:00)
View GitHub Profile
# Python code sample to listen to TCP multicast traffic on
# port 67 (?), which should be traffic destined to a DHCP server
# that will listen to multicast on that port.
# Tested on OSX.
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# Next line might or might not work, depending on your platform.
@cdemers
cdemers / Installing a Go development environment on Mac OS for beginners.md
Last active June 21, 2020 20:08
How to install a functional Go development environment on MacOS with Atom and all the bells and whistles.

Warning! This doc is pretty outdated, I'm rewriting it right now and I'll update this as soon as it's done.


Installing a Go development environment on Mac OS for Beginners

Installing Go

First, install the Go compiler from Google's Go Website: https://golang.org/dl/

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 / raspi-blacklist.conf
Last active May 27, 2019 18:14
Disable WiFi and Bluetooth on a Raspberry Pi 3
# To disable WiFi and Bluetooth on a Raspberry Pi 3, there is
# no other way (yet) than to add this file to the modprobe.d
# folder (/etc/modprobe.d/raspi-blacklist.conf)
# Prevents WiFi:
blacklist brcmfmac
blacklist brcmutil
# Prevents Bluetooth:
blacklist btbcm
@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 / 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 / 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."