Skip to content

Instantly share code, notes, and snippets.

@ciiqr
ciiqr / make-it-root.sh
Last active October 9, 2022 04:47
macos rerun script as root with (gui) user prompt
#!/usr/bin/env bash
# $ ./make-it-root.sh with params <<<"and stdin"
set -e
# if not run as root, prompt user to allow this to run as root
# NOTE: Must use `whoami`, $USER won't be set when run this way, which will cause this to trigger recursively
if [[ "$(whoami)" != 'root' ]]; then
exec osascript - "$0" "$@" 3<&0 <<APPLESCRIPT
@ciiqr
ciiqr / devshell.toml
Created September 25, 2022 23:57
nix devshell node "canvas" dependencies for maco m1 (arm)
[devshell]
packages = [
# node
"nodejs-18_x",
# node canvas deps
"pkg-config",
"cairo",
"cairo.dev",
"pango",
@ciiqr
ciiqr / devshell.toml
Last active September 25, 2022 23:55
rust dev environment in devshell - with rust-analyzer support
[devshell]
packages = [
"rustup",
]
[devshell.startup.rust]
text = """
rustup default stable
rustup component add rust-src
"""
@ciiqr
ciiqr / build.yml
Created April 16, 2022 05:06
Github actions matrix build for all packages in a monorepo
name: build
on:
push:
branches:
- main
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.set_packages.outputs.packages }}
@ciiqr
ciiqr / update-yarn.yml
Created November 29, 2021 18:18
Github action to update yarn.lock (not fully tested yet)
name: Update yarn.lock
on:
push:
branches:
- main
jobs:
yarn.lock:
runs-on: ubuntu-latest
steps:
# setup
@ciiqr
ciiqr / test
Created July 18, 2020 02:19
test data 123
me
you
them
@ciiqr
ciiqr / Dockerfile
Last active February 13, 2020 17:40
docker build with ssh agent
# syntax=docker/dockerfile:1.0-experimental
FROM ubuntu
RUN apt update && apt install -y openssh-client
RUN --mount=type=ssh ssh-add -l > /tmp/ssh-working-agent.out
@ciiqr
ciiqr / dispatch.sh
Last active February 19, 2025 12:25
github actions, repository_dispatch with client_payload
# TODO: replace :token, :user, and :repo
curl -H "Authorization: token :token" \
-H 'Accept: application/vnd.github.everest-preview+json' \
"https://api.github.com/repos/:user/:repo/dispatches" \
-d '{"event_type": "awesomeness", "client_payload": {"foo": "bar"}}'
@ciiqr
ciiqr / terragrunt-0.12upgrade.sh
Last active June 25, 2019 14:59
Script for upgrading modules to 0.12 which are used by terragrunt (this has several hard coded and specialized parts, thus this should only be used as inspiration)
#!/usr/bin/env bash
set -e # exit on failure
# set -x # print commands before executing them
arrayContains()
{
declare e match="$1"
shift
for e; do
@ciiqr
ciiqr / PasswordMunge.py
Created June 7, 2019 01:37
convert keepassx2 csv to 1password format (with group name as custom field)
import csv
import json
from os import path
KEEPASS_COLUMNS = [
"Group","Title","Username","Password","URL","Notes"
]
ONE_PASSWORD_COLUMNS = [
'title','website','username','password','notes','custom field 1'