Skip to content

Instantly share code, notes, and snippets.

View blakewatters's full-sized avatar

Blake Watters blakewatters

View GitHub Profile
@MineRobber9000
MineRobber9000 / donotuse3.py
Last active February 8, 2024 12:48
How to NEVER use lambdas - Python 3 edition
###########################################################
# How to NEVER use lambdas. An inneficient and yet educa- #
# tonal [sic] guide to the proper misuse of the lambda #
# construct in Python 3.x. [DO NOT USE ANY OF THIS EVER] #
# original by (and apologies to): e000 (13/6/11) #
# now in Python 3 courtesy of: khuxkm (17/9/20) #
###########################################################
## Part 1. Basic LAMBDA Introduction ##
# If you're reading this, you've probably already read e000's
@sam-writer
sam-writer / mkpoetryproj.sh
Created May 14, 2020 22:29
Make Poetry and VSCode play nicely
mkpoetryproj ()
{
if [ $# -eq 1 ]; then
poetry new "$1"
cd "$1" || exit
# get gitignore
curl https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore -o .gitignore
{
echo ""
echo ".vscode/"
@jayphelps
jayphelps / script.sh
Created May 1, 2020 06:56
Add .crt SSL certificate to macOS Keychain via command line
SCRIPT="security add-trusted-cert -d -r trustAsRoot -p ssl -p basic -k /Library/Keychains/System.keychain "filename.crt""
osascript -e "do shell script \"$SCRIPT\" with administrator privileges"
# or you can just run the above SCRIPT command with sudo directly.
# This osascript stuff is so that you get a native OS password prompt
@stettix
stettix / things-i-believe.md
Last active March 20, 2024 17:45
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

I want to mount a previous Synology basic volume (wasn't using RAID or SHR) to copy data to a new drive.

Plug it in the USB port doesn't work, showing (Partition 1 does not start on phyical sector boundary).

# fdisk -l
Disk /dev/sdr: 2.7 TiB, 3000558944256 bytes, 5860466688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
@atotto
atotto / ssh.go
Last active August 11, 2023 02:43
golang ssh terminal client
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
@bb010g
bb010g / .zshrc
Created April 29, 2019 06:06
example nice Zsh
HISTSIZE=50000
SAVEHIST=50000
HISTFILE=~/.zsh_history
# sane zplug installation defaults
if [[ -z "$ZPLUG_HOME" ]]; then
ZPLUG_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/zplug"
fi
if [[ -z "$ZPLUG_CACHE_DIR" ]]; then
ZPLUG_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/zplug"
@dataday
dataday / credentials-management.md
Last active October 22, 2023 06:47
docker + docker credential helpers + pass + gpg2 + coffee

Credentials Management

This guide describes setting out a credential storage mechanism that is shared between the root account, aka releasr, and jenkins account. It intends to support and persist access credentials that are needed when authenticating with external services, primarily Docker Hub, for users wishing to access remote Docker images as part of their containerised services.

The following diagram aims to describe the control flow this setup intends to support.

Credentials Management

This guide is a first, and a tad complicated sorry, pass at setting this up. It got us over the line for a couple of uses cases as well as working with automated build jobs.

@pahud
pahud / main.workflow
Last active July 24, 2023 08:20
Github Actions with Amazon EKS CI/CD
workflow "Demo workflow" {
on = "push"
resolves = ["SNS Notification"]
}
action "Build Image" {
uses = "actions/docker/cli@c08a5fc9e0286844156fefff2c141072048141f6"
runs = ["/bin/sh", "-c", "docker build -t $IMAGE_URI ."]
env = {
IMAGE_URI = "xxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/github-action-demo:latest"
@npearce
npearce / install-docker.md
Last active April 19, 2024 12:35
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start