Skip to content

Instantly share code, notes, and snippets.

View ericboehs's full-sized avatar

Eric Boehs ericboehs

  • Oddball
  • Enid, OK
  • 20:23 (UTC -05:00)
View GitHub Profile
@ericboehs
ericboehs / kiwix-add.sh
Last active April 2, 2024 20:03
Sync with Kiwix.org and update zim files
#!/bin/bash
xml="/volume1/kiwix-share/"
library="/volume1/kiwix-share/"
log=($(find $library -name '*.zim' | sort))
if [ -f "$xml/library.log" ]; then
IFS=$'\n' read -d '' -r -a oldlog < "$xml/library.log"
fi
if [[ "${log[@]}" == "${oldlog[@]}" ]]; then
@ericboehs
ericboehs / ghmpr
Last active February 14, 2024 16:50
#! /usr/bin/env bash
# Ensure GitHub CLI and jq are installed
if ! command -v gh &> /dev/null || ! command -v jq &> /dev/null; then
echo "Error: This script requires the GitHub CLI (gh) and jq to be installed."
exit 1
fi
# Optional: Define GIT_DEFAULT_BRANCH if not set in the environment
if [ -z "$GIT_DEFAULT_BRANCH" ]; then
#! /usr/bin/env bash
# <bitbar.title>VA SOCKS</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Eric Boehs</bitbar.author>
# <bitbar.author.github>ericboehs</bitbar.author.github>
# <bitbar.desc>Connects to VA SOCKS and provides useful links</bitbar.desc>
# <swiftbar.hideAbout>true</swiftbar.hideAbout>
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
@ericboehs
ericboehs / gh-pr-status-markdowner.js
Last active January 31, 2024 20:56
GitHub PR Status Markdowner
// ==UserScript==
// @name GitHub PR Status Markdowner
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Copy MD of GitHub PR Review Statuses
// @author Eric Boehs
// @match https://github.com/pulls*
// @grant GM.setClipboard
// @run-at document-ready
// @inject-into content
@ericboehs
ericboehs / yt
Last active November 13, 2023 18:49
Offline YouTube
#! /usr/bin/env ruby
# Eric's Offline YouTube (Download YT videos via Downie with JSON metadata and image previews and then run this script)
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'json'
@ericboehs
ericboehs / review.sh
Created November 9, 2023 16:38
Review PRs ZSH Function
review_pr() {
pr_id=$1
gh pr view $pr_id --comments; git fetch -q; out_of_date=$(git rev-list --left-right --count origin/$GIT_MASTER_BRANCH...$(echo "origin/$(gh pr view $pr_id --json headRefName | jq .headRefName | tr -d '\"')") | awk '{print $1}'); [[ $out_of_date -gt 20 ]] && echo "‼️ Branch is $out_of_date commits out of date with $GIT_MASTER_BRANCH."; gh pr checks $pr_id; gh pr diff $pr_id; echo -n "[approve] or request-changes? "; read review; gh pr review $pr_id --${review:-approve}
}
review_prs() {
pr_id=$(GH_FORCE_TTY=100 gh pr list --limit 200 --search "is:pr is:open draft:false NOT WIP in:title review-requested:@me review:required -label:Lighthouse label:console-services-review" | fzf --ansi --preview 'GH_FORCE_TTY=100 gh pr view {1}' --preview-window down --header-lines 3 | awk '{print $1}' | tr -d '#');
review_pr $pr_id
}
@ericboehs
ericboehs / sidekiq-env-highlighter.js
Last active October 31, 2023 16:17
Sidekiq Env Highlighter
// ==UserScript==
// @name Sidekiq Environment Highlighter
// @description Changes navbar color based on which Sidekiq env you're viewing
// @match *://*.va.gov/sidekiq*
// @run-at document-ready
// ==/UserScript==
if (document.URL.includes("staging-api.va.gov/sidekiq")) {
document.getElementsByClassName("navbar-default")[0].style.backgroundColor = "peachpuff";
} else if (document.URL.includes("dev-api.va.gov/sidekiq")) {
@ericboehs
ericboehs / zh2gh-redirect.js
Last active October 26, 2023 17:59
Redirects ZenHub links to GitHub Issues
// ==UserScript==
// @name ZenHub to GitHub Redirect
// @namespace boehs.com
// @include *://app.zenhub.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
(() => {
const regex = /https:\/\/app\.zenhub\.com\/workspaces\/.+\/issues\/gh\/(.+\/.+?)\/(\d+)$/;
@ericboehs
ericboehs / config.ru
Last active September 28, 2023 18:21
Testing nginx locally with Rails
# frozen_string_literal: true
# This file is used by Rack-based servers to start the application.
require_relative 'config/environment'
map Rails.application.config.relative_url_root || '/' do
run Rails.application
Rails.application.load_server
end
@ericboehs
ericboehs / VA Datadog Warning Hider.user.css
Created September 8, 2023 15:22
Hide a certain warning in Datadog
/* ==UserStyle==
@name VA Datadog Warning Hider
@description Hides the "WARNING! This system contains U.S. Government information" alert.
@match https://vagov.ddog-gov.com/*
==/UserStyle== */
.single-page-app_layout_fedramp-warning-top-bar { display: none !important }