Skip to content

Instantly share code, notes, and snippets.

View bowmanmike's full-sized avatar

Mike Bowman bowmanmike

View GitHub Profile
@bowmanmike
bowmanmike / jqi.sh
Created February 13, 2025 19:43
Interactive JSON Searching with JQ
#!/bin/sh
jq "." -C "$1" |
fzf --ansi --phony --reverse \
--bind "change:reload(jq {q} -C $1)" \
--bind "enter:execute-silent(echo {} | xsel)" \
--bind "ctrl-k:reload(jq {q}' | keys' -C $1)"
@bowmanmike
bowmanmike / git-checkout-pr
Created December 19, 2024 16:21
Github CLI + FZF Script to browse and checkout PRs
#!/bin/bash
# Check if gh and fzf are installed
command -v gh >/dev/null 2>&1 || { echo >&2 "GitHub CLI (gh) is not installed. Exiting."; exit 1; }
command -v fzf >/dev/null 2>&1 || { echo >&2 "fzf is not installed. Exiting."; exit 1; }
# Check if we're in a git repository
git rev-parse --is-inside-work-tree >/dev/null 2>&1 || { echo >&2 "Not in a git repository. Exiting."; exit 1; }
# Get the current repository name
@bowmanmike
bowmanmike / pre-push
Last active October 28, 2020 20:52
Print confirmation before pushing to master
branch="$(git branch --show-current)"
if [ $branch = "master" ]; then
echo "WARNING!!!"
echo "You're currently pushing directly to master!"
echo ""
read -p "Are you sure? Type 'yes' to confirm: " answer
if [ $answer = "yes" ]; then
echo "Pushing..."
@bowmanmike
bowmanmike / tasks.json
Created June 6, 2020 21:10
VSCode Elixir tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "mix test -- all",
"type": "shell",
"group": "test",
"command": "mix test",
@bowmanmike
bowmanmike / daily_progress_template.md
Created July 6, 2017 17:51
Daily progress tracker template
@bowmanmike
bowmanmike / bd3d4befe38185704bf0fc875e9deed6|configuration.json
Last active December 8, 2020 15:42
Visual Studio Code Sync Settings Gist
{"contents":{"python":{"pythonPath":"/usr/local/bin/python"},"launch":{"version":"0.2.0","configurations":[{"name":"Listen for rdebug-ide","type":"Ruby","request":"attach","cwd":"${workspaceRoot}","remoteHost":"127.0.0.1","remotePort":"1234","remoteWorkspaceRoot":"${workspaceRoot}"},{"name":"Rails server","type":"Ruby","request":"launch","cwd":"${workspaceRoot}/thescore-api","program":"${cwd}/bin/rails","args":["server"]},{"name":"RSpec - active spec file only","type":"Ruby","request":"launch","cwd":"${workspaceRoot}","program":"/Users/mbowman/thescore/sports/thescore-pulse/pulse/bin/rspec","args":["--require","spec_helper","${file}"]}]},"tasks":{"version":"2.0.0","tasks":[{"label":"rake db:migrate","type":"shell","command":"bundle exec rake db:migrate","options":{"cwd":"/Users/mbowman/thescore/sports/thescore-api"},"problemMatcher":[]},{"label":"rake db:test:prepare","type":"shell","command":"bundle exec rake db:test:prepare","options":{"cwd":"/Users/mbowman/thescore/sports/thescore-api"},"problemMatcher":[]
@bowmanmike
bowmanmike / dynamic_function_calls.go
Created February 22, 2017 19:06
Golang Dynamic Function Calling
package main
import (
"fmt"
)
// Use map[string]interface{} to pair functions to name
// Could maybe use anonymous functions instead. Might be clean
// in certain cases
var funcMap = map[string]interface{}{
Atom Sync Settings
@bowmanmike
bowmanmike / coverage
Last active November 28, 2016 21:44
Go Test Coverage Aggregator
#!/bin/sh
# Generate test coverage statistics for Go packages.
# Adapted from https://github.com/mlafeldt/chef-runner/blob/v0.7.0/script/coverage
#
# Works around the fact that `go test -coverprofile` currently does not work
# with multiple packages, see https://code.google.com/p/go/issues/detail?id=6909
#
# Usage: script/coverage [--html|--coveralls]
#
# --html Additionally create HTML report and open it in browser