Skip to content

Instantly share code, notes, and snippets.

View alastairhm's full-sized avatar

Alastair Montgomery alastairhm

View GitHub Profile
@andypiper
andypiper / temp-check.py
Created March 21, 2022 14:18 — forked from lesp/temp-check.py
Using a BME688 Temperature sensor with Pimoroni's Badger 2040. Code is based on the BME688 example, but with added Badger 2040 code.
"""BME688 / BME680 demo
This demo will work for both the BME680 and BME688.
"""
import time
from breakout_bme68x import BreakoutBME68X, STATUS_HEATER_STABLE
from pimoroni_i2c import PimoroniI2C
import badger2040
import machine
badger = badger2040.Badger2040()
@reegnz
reegnz / README.md
Last active June 14, 2023 19:20
Using terraform for_each and toset instead of count

Using terraform for_each and toset instead of count

Using terraform count and the pain of working with it

If you're using terraform extensively you probably ran into an issue like this.

This is a synthetic example but I still hope the problem is recognizable as something that also happens out in the wild.

First, you have a list variable (in terraform.tfvars)

################
# ARDUINO PART #
################
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9
#define SS_PIN 10 //SDA
#define SCK_PIN 12
#define MOSI_PIN 13
@riccardomc
riccardomc / oidc-thumbprint.sh
Created November 28, 2019 10:52
Extract OIDC provider thumbprint given an AWS EKS cluster name
#!/bin/bash
set -e
if [ ! -z "$DEBUG" ] ; then
set -x
fi
CLUSTER_NAME=$1
@alexellis
alexellis / README.md
Last active May 3, 2018 23:07
Dockerfile for the Blinkt!

Install Docker

# curl -sSL get.docker.com | sh
# sudo usermod pi -aG docker
# exit

Reconnect and:

@subfuzion
subfuzion / README.md
Last active May 11, 2024 17:03
vim/neovim configuration

I recently switched over to neovim (see my screenshots at the bottom). Below is my updated config file.

It's currently synchronized with my .vimrc config except for a block of neovim-specific terminal key mappings.

This is still a work in progress (everyone's own config is always a labor of love), but I'm already extremely pleased with how well this is working for me with neovim. While terminal mode isn't enough to make me stop using tmux, it is quite good and I like having it since it simplifies my documentation workflow for yanking terminal output to paste in a markdown buffer.

These days I primarily develop in Go. I'm super thrilled and grateful for fatih/vim-go,

@alastairmccormack
alastairmccormack / x509_sha1_fingerprint.py
Created November 13, 2015 03:40
Gets a SHA1 fingerprint from an x509 certificate using Python and OpenSSL crypto module
from OpenSSL.crypto import load_certificate, FILETYPE_PEM
cert_file_string = open("esx.crt", "rb").read()
cert = load_certificate(FILETYPE_PEM, cert_file_string)
sha1_fingerprint = cert.digest("sha1")
print sha1_fingerprint
@RC1140
RC1140 / gist:3299197
Created August 8, 2012 22:01
Arduino LCD Scrolling
#include <LiquidCrystal.h>
#include <string.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
char message[] = "This is some long message that will end up scrolling";
int previous = 0;
int pos = 0;
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 26, 2024 07:44
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"