Skip to content

Instantly share code, notes, and snippets.

View cdemers's full-sized avatar

Charle Demers cdemers

  • Wellington & King, Inc.
  • Montreal
  • 04:30 (UTC -04:00)
View GitHub Profile
@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
# Stop all local containers
docker stop $(docker ps -a)
# Remove all local containers
docker rm $(docker ps -a -q)
// === BEGIN ===
[Unit]
Description=Datadog Agent
After=multi-user.target
[Service]
Type=idle
ExecStart=/the_path/.datadog-agent/bin/agent
Restart=always
# This bashrc is aimed at clustered CoreOS marchines running on
# VMware. It will display the IP of the ens192 VMware interface
# in the prompt, which is useful to identify the host in a cattle
# type cluster.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# 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.
#!/bin/sh
# Starts a bash within a container running on Kubernetes while initializing
# the terminal type to xterm and the size to your actual terminal size. Makes
# it possible to have vi, more, etc work in a usable way until PR #25273 is
# merged. Derived from a snip by Hubert Chen (https://github.com/hubt)
if [ "$1" = "" ]; then
echo "Usage: kbash.sh {pod} [container]"
exit 1
fi
@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/

@cdemers
cdemers / SampleGoHttpPost.go
Created May 5, 2016 13:33
Sample Go program that does an HTTP post of a JSON payload, includes setting request headers, doing the request, getting the response and printing it out.
func main() {
var jsonBuffer = []byte(`{"my_key":"My Value."}`)
req, _ := http.NewRequest("POST", "http://api.mycompany.com", bytes.NewBuffer(jsonBuffer))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {