Skip to content

Instantly share code, notes, and snippets.

@wfairclough
wfairclough / aws-sso.sh
Last active February 28, 2024 02:04
AWS cli SSO quick select shell script
#!/bin/bash
#
# Quick search and select the AWS profile to use for SSO login
AWS_PROFILE=$(cat ~/.aws/config | rg 'profile' | awk '{print $2}' | sed 's/]//g' | sort | fzf)
if [ -z "$AWS_PROFILE" ]; then
echo "No profile selected"
exit 1
fi
@wfairclough
wfairclough / send.sh
Created February 3, 2024 03:41 — forked from miguelmota/send.sh
Golang UDP server example
echo 'hello world' > /dev/udp/0.0.0.0/3000
@wfairclough
wfairclough / sl-value-accessors.module.ts
Last active November 21, 2023 17:18
ControlValueAccessors for Shoelace Custom Elements
import { Directive, forwardRef, NgModule, ElementRef, Renderer2 } from '@angular/core';
import {
CheckboxControlValueAccessor,
DefaultValueAccessor,
FormsModule,
NG_VALUE_ACCESSOR,
RadioControlValueAccessor,
ReactiveFormsModule,
SelectControlValueAccessor,
SelectMultipleControlValueAccessor,
@wfairclough
wfairclough / launch.json
Created December 8, 2021 23:33 — forked from cecilemuller/launch.json
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
@wfairclough
wfairclough / build_redis_cli_tls.sh
Last active August 30, 2021 20:26
Script to Download and build redis-cli with tls support on Ubuntu
sudo apt install -y git curl jq net-tools build-essential gcc clang wget tcl tcl-dev libssl-dev libjemalloc-dev pkg-config
wget http://download.redis.io/redis-stable.tar.gz
tar xvf redis-stable.tar.gz
cd redis-stable
cd deps
CC=clang make BUILD_TLS=yes hiredis lua jemalloc linenoise
cd ..
CC=clang make BUILD_TLS=yes
src/redis-cli -h <CLUSTER_HOST> -c -p 6379 --tls --user <USER> --pass <PASSWORD>

Keybase proof

I hereby claim:

  • I am wfairclough on github.
  • I am wextux (https://keybase.io/wextux) on keybase.
  • I have a public key ASAh-7hXnZneTFqQwWTtPJzizSoB1GzXLwramq7X4lH65Qo

To claim this, I am signing this object:

@wfairclough
wfairclough / pandoc2redmine.sh
Last active August 27, 2015 22:52 — forked from dergachev/pandoc2redmine.sh
pandoc2redmine.sh - wrapper script on pandoc to fix textile output for Redmine compatibility
#! /bin/env bash
cat $1 | ruby -pe 'puts " "*20 if $_.match("^```$")' \
| pandoc -f markdown -t textile \
| ruby -r CGI -n -e 'print CGI.unescapeHTML($_);' \
| ruby -ne 'puts $_ unless $_.match(" "*20)' \
| pbcopy
# without spaces, pandoc outputs "bc." for code blocks, which isn't accepted to redmine
# it also annoyingly HTML escapes its pre- block contents
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl