Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am cqsd on github.
* I am cqsd (https://keybase.io/cqsd) on keybase.
* I have a public key ASDgyiV0RiYbcK9vcOefeL1cqWMJbZExGzTfI8l7Z2NZ5wo
To claim this, I am signing this object:
@cqsd
cqsd / readme.md
Created September 14, 2021 07:14
workaround for qemu segmentation fault when compiling inside of docker build on m1 mac

if you've been using qemu emulation to do your whole build in a different architecture like this

docker buildx build --platform=linux/amd64 -t whatever .

and you've been getting a segmentation fault at some point like this,

> [builder 4/4] RUN CGO_ENABLED=0 go build -ldflags '-w -extldflags "-static"' -o whatever ./cmd/whatever
@cqsd
cqsd / README.txt
Created September 14, 2021 05:09
An AWS Lambda runtime in bash
Invoke with SQS.
{ command: "ls $1", "argv": "/tmp" }
@cqsd
cqsd / a.sh
Created September 9, 2021 18:42
run a shell in the docker host (use on dOckeR for mac or windoze)
#!/bin/sh
# (in kubernetes, you'd use AllowPrivilegeEscalation probably, idk. exercise for the reader)
docker run -it \
--privileged \
--pid=host \
alpine \
nsenter -t 1 -m -u -n -i bash
# nsenter # exec something in a namespace (analogous to su -c)
@cqsd
cqsd / readme.macos.md
Last active April 10, 2023 15:37
Use the macOS `security` tool to manage [minor] secrets

cringe

export GITHUB_TOKEN=ghp_adiugaslhdg...
export IQAIR_API_KEY=oiheorhialjkfbld...

based

# add a new token called "cqsd/auth-only" for the "github" service to the macOS keychain
@cqsd
cqsd / readme.md
Last active August 19, 2021 23:11
howto: docker init containers

howto: docker init containers

what is it

a container that sets up for other containers. for example, you could populate a database with seed data and share it with your real db container through a volume

support was added in this PR but i haven't seen easily google-able docs yet (maybe im just bad at searching)

@cqsd
cqsd / README.md
Created July 27, 2021 07:01
Typescript utils

Some functions I end up using in just about every js project.

@cqsd
cqsd / bullshit.md
Last active May 23, 2021 02:31
various kubernetes bullshit
@cqsd
cqsd / .eslintrc.js
Created February 9, 2021 01:38
default typescript vue project eslint + prettier
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:vue/vue3-essential',
@cqsd
cqsd / async-limit.js
Created July 2, 2020 04:11
basically a closure-based semaphore
/**
* Limit concurrent asynchronous execution of a function.
*
* Stolen from this:
* https://dev.to/ycmjason/limit-concurrent-asynchronous-calls-5bae
*
* @param fn {Function} async function
* @paranm n {Number} max execution concurrency
*/
const asyncLimit = (fn, n) => {