Skip to content

Instantly share code, notes, and snippets.

View slaughtr's full-sized avatar

Dallas slaughtr

  • PNW
View GitHub Profile
@slaughtr
slaughtr / mupen
Created March 15, 2024 21:42
mupen
# Thanks chat gippity!
# This zsh function simplifies jumping around many repos. And single repos, too
# It attempts to checkout the current dir's git repo main branch, fetch and pull, and open the directory in VS Code
# If there are unstaged changes in the current branch, it shows a diff and asks y/n if you want to discard those changes
# If yes, it continues as normal (checkout main, fetch, pull, VSC). If no, it aborts
# Why "mupen"? It's some amalgamation of main, pull, and open :shrug:
# Define the function
mupen() {
# Attempt to checkout the main branch. If there are no changes, this will succeed.
@slaughtr
slaughtr / prcache
Created March 15, 2024 21:45
prcache
# Another ChatGPT win, I only had to make one change
# This just builds a JSON-based cache (in your home dir, update the cacheFile if you don't like that) based on a git branch name, commit message, and pull request body
# Using those, it will create a new branch, add a commit, and (using the gh CLI) create a PR with the cached body
# This allows for however many cached values you need
# Pretty much only useful for large-scale small-change PR rollouts, like small GHA updates etc
prcache() {
cacheFile="$HOME/.git_pr_cache.json"
# Initialize the cache file with an empty array if it doesn't exist
@slaughtr
slaughtr / find-action-in-workflows.js
Created March 19, 2024 20:18
Find if a specific action is present in the workflows of all repos in an org. Outputs CSV for review. Not perfect, Github API doesn't like some things.
const { Octokit } = require("@octokit/rest");
const createCsvWriter = require('csv-writer').createObjectCsvWriter;
// Initialize Octokit with your GitHub token from environment variable
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
// CSV setup
const csvWriter = createCsvWriter({
path: 'compliance_check_result.csv',
header: [
@slaughtr
slaughtr / gist:17564d9f4aac7f3b20dc1b604e155aff
Created April 11, 2024 17:44
Kagi CSS to be more like the old theme and remove those underlines in links
:root {
--custom-bg-color: #090c10;
--search-result-gap: 20px;
--search-result-gap-mobile: 10px;
--app-bg: var(--custom-bg-color);
--search-result-title: #fff;
--primary-visited: #aaa;
/*! --quick-search-bg: #000; */