Skip to content

Instantly share code, notes, and snippets.

View bradymholt's full-sized avatar

Brady Holt bradymholt

View GitHub Profile
@bradymholt
bradymholt / gist:15d210f3eee4637d3a20ca3f74d9cc6a
Created November 22, 2019 18:05
Delete Private GitHub Docker Registry packages
# Find latest version of packages
curl -X POST \
-H "Accept: application/vnd.github.package-deletes-preview+json" \
-H "Authorization: bearer $GITHUB_API_TOKEN" \
-d '{"query":"query { repository(owner:\"johndoe\", name:\"myepo\") { registryPackagesForQuery(first:10) { edges { node { latestVersion { id } } } } } }"}' \
https://api.github.com/graphql
# Example output from above command
# {"data":{"repository":{"registryPackagesForQuery":{"edges":[{"node":{"latestVersion":{"id":"MDE01234523233"}}}]}}}}
@bradymholt
bradymholt / advanced.config
Created September 1, 2018 21:08
rabbitmq-email config
[
{rabbitmq_email, [
%% gen_smtp server parameters
%% see https://github.com/Vagabond/gen_smtp#server-example
{server_config, [
[{port, 2525}, {protocol, tcp}, {domain, "geekytidbits.com"}, {address,{0,0,0,0}}]
]},
%% how clients are authenticated; either 'false' or 'rabbitmq' (default)
{server_auth, false},
%% whether STARTTLS shall be offered; either 'true' or 'false' (default)
@bradymholt
bradymholt / Zbig-o.png
Last active October 22, 2021 13:16
Computer Science Concepts
Zbig-o.png
@bradymholt
bradymholt / index.ts
Last active June 20, 2017 16:51
Delete GitHub releases and tags matching a prefix pattern
/*
Example usage:
ts-node index.ts bradyholt/repo123 ~/dev/repo123 devtag
*/
import axios from "axios";
import childProcess = require("child_process");
let repoName = process.argv[2];
let repoPath = process.argv[3];
@bradymholt
bradymholt / playbook.yml
Last active September 22, 2016 22:09
Create Digital Ocean Droplet with Ansible
- name: Digital Ocean
hosts: all
connection: local
gather_facts: false
vars:
do_token: abc123
droplets:
- vippers-one
- vippers-two
- vippers-three
@bradymholt
bradymholt / locale-dow-moy.js
Last active August 4, 2016 16:19
(JavaScript) Prints days of week and months of year for a specified list of locales
var locales = [
'en', // English
'es', // Spanish
'fr' // French
];
function printDaysOfTheWeek(locale) {
var daysOfTheWeek = [];
var monday = new Date();
monday.setDate(monday.getDate() - (monday.getDay() + 6) % 7);
@bradymholt
bradymholt / lame_podcast.sh
Created May 2, 2016 14:20
Convert WAV to MP3 using LAME for podcast
lame -V6 --vbr-new --resample 22 -m m recording.wav
@bradymholt
bradymholt / ghp
Created April 12, 2016 22:48
Open GitHub Pull Request in Browser for Current Working Branch
#!/bin/bash
# Opens GitHub PR for the current branch
BRANCH=$(git branch | grep ^* | sed 's/* //' )
URL="https://github.$(git config remote.origin.url | cut -f2 -d. | tr ':' /)/pull/${BRANCH}"
open $URL%
@bradymholt
bradymholt / arbitrary_function.sql
Created February 1, 2016 14:54
Postgres snippets
CREATE FUNCTION fred() RETURNS blah AS $$
$$ LANGUAGE 'plpgsql';
SELECT fred();
DROP FUNCTION fred();
@bradymholt
bradymholt / json_mode
Last active January 21, 2021 08:25
Ansible module to replace values in JSON files https://www.geekytidbits.com/ansible-module-modify-json/
#!/usr/bin/env node
var fs = require('fs');
var args = fs.readFileSync(process.argv[2], 'utf8');
var changed = false;
var jsonPath = null;
var json = null;
var keyValReplacementString = args.split(' ');
keyValReplacementString.forEach(function(i){