Skip to content

Instantly share code, notes, and snippets.

View darksinge's full-sized avatar

Craig Blackburn darksinge

View GitHub Profile
set fstate "$HOME/.local/state/tmp-stack.json"
function fee
if test (count $argv) -eq 0
__fee_push
return 0
end
if string match -qr '^[-+]?[0-9]+$' -- $argv[1]
__fee_at $argv[1]
@darksinge
darksinge / find-lambda.sh
Last active September 18, 2024 15:13
A script to look up lambda functions belonging to a Cloudformation stack and open it in a browser window.
#!/usr/bin/env bash
set -e
export DEBUG=0
export AWS_REGION="us-east-1"
function debug() {
if [ $DEBUG -eq 1 ]; then
echo "ERROR: $@" >&2
@darksinge
darksinge / Custom SST Auth Adapter.md
Last active July 17, 2024 05:03
Custom SST Auth Adapter

First, the Auth construct adds an /auth route to the API.

const auth = new Auth(stack, 'auth', {
  authenticator: {
    handler: 'auth.handler',
  },
});

const api = new Api(stack, 'api', {
@darksinge
darksinge / lua.lua
Created April 6, 2023 22:01
Filetype detection: add "print statement" shortcuts to which-key (tailored for LunarVim)
local wk_ok, wk = pcall(require, "which-key")
if not wk_ok then
return
end
local vopts = lvim.builtin.which_key.vopts
local opts = lvim.builtin.which_key.opts
local mappings = {
["z"] = {
@darksinge
darksinge / eslint-and-prettier-setup.md
Last active October 5, 2022 16:10
Eslint+prettier setup

Typescript Setup (npm)

Install dependencies

$ npm i --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin prettier eslint-config-prettier eslint-plugin-prettier

.eslintrc.js

module.exports = {
@darksinge
darksinge / trigger.sh
Created August 24, 2020 21:40
How to manually trigger a GitHub Action through the GitHub API
#!/usr/bin/env bash
# Get the <token> through the GitHub website:
# 1. Go to Settings->Developer Settings->Personal access tokens
# 2. Create a token with the 'repo' scope selected.
# https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
# The value for "event_type" should match "on.repository_dispatch.type" in workflow.yaml.
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
@darksinge
darksinge / DOCKER_CHEAT_SHEET.md
Last active October 2, 2023 18:40
Kubernetes Cheat Sheet (and minikube, docker, kubectl, eksctl, and AWS ECR)

Docker Commands

  • docker exect -it myimage /bin/bash
  • docker build --tag myimage:tag_name .
  • docker container attach myimage
  • docker run -itd --name <name> --network <network> --publish 80:8080 myimage:tag
  • docker image tag myimage myrepo/myimage:tag
  • docker image push myrepo/myimage:tag
@darksinge
darksinge / cloudSettings
Last active June 4, 2020 20:13
cloudSettings
{"lastUpload":"2020-06-04T20:13:28.728Z","extensionVersion":"v3.4.3"}
@darksinge
darksinge / nginx.stuff
Created January 24, 2020 20:44
NGINX Config Example
# /etc/nginx/nginx.conf
http {
...
include /etc/nginx/sites-available/*.conf # Include all config files that end in .conf
...
}
# /etc/nginx/sites-available/example.com.conf
server {
listen 80 default_server;
@darksinge
darksinge / eeprom.py
Last active May 19, 2019 21:02
Python script to control a Raspberry Pi's GPIO pins for programming an EEPROM (work in progress...)
import RPi.GPIO as GPIO
import os
import time
import math
usleep = lambda x: time.sleep(x / 1000000.0)
GPIO.setwarnings(False)