Skip to content

Instantly share code, notes, and snippets.

View scjudd's full-sized avatar

Spencer Judd scjudd

View GitHub Profile

Keybase proof

I hereby claim:

  • I am scjudd on github.
  • I am scjudd (https://keybase.io/scjudd) on keybase.
  • I have a public key whose fingerprint is E071 7683 5BB7 6530 200E E2D4 63F4 0394 77D6 CA8D

To claim this, I am signing this object:

@scjudd
scjudd / kubectl-ctx
Last active February 8, 2022 14:22
kubectl context and namespace helpers
#!/bin/bash
if [ "$#" -lt 1 ]; then
kubectl config current-context
else
kubectl config use-context $1
fi
use crate::hash;
use std::convert::TryFrom;
const ALPHABET: [char; 58] = [
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K',
'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e',
'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
'z',
];
@scjudd
scjudd / git-jira
Last active February 14, 2020 19:20
git-jira: easily associate a ticket URL with a branch, allowing for quickly opening tickets in your browser
#!/bin/bash
set -eo pipefail
refspec="+refs/jira/*:refs/jira/*"
function default_remote {
git config jira.remote || {
>&2 echo "No remote specified and no default configured."
>&2 echo "Run \`git jira setup <REMOTE_NAME>\` to set a default remote."
exit 1
@scjudd
scjudd / git-ticket
Created February 14, 2020 17:55
git-ticket
#!/bin/bash
set -eo pipefail
refspec="+refs/tickets/*:refs/tickets/*"
function default_remote {
echo $(git config ticket.remote) || {
>&2 echo "No remote specified and no default configured."
>&2 echo "Run \`git ticket setup <REMOTE_NAME>\` to set a default remote."
exit 1
[Unit]
Description=SSL Certificate Renewal
After=syslog.target
After=network.target
[Service]
ExecStart=/usr/local/bin/certbot-init.sh certbottesting.aacc.net
[Install]
WantedBy=multi-user.target
@scjudd
scjudd / add-user.php
Created May 18, 2018 21:53
PHP to create a WordPress admin user
<?php
require_once('wp-blog-header.php');
require_once('wp-includes/registration.php');
$username = 'spencer';
$password = 'f00b4rb4z!';
$email = 'spencercjudd@gmail.com';
if (!username_exists($username) && !email_exists($email)) {

Keybase proof

I hereby claim:

  • I am scjudd on github.
  • I am scjudd (https://keybase.io/scjudd) on keybase.
  • I have a public key ASC0pMfg2B6QkZug2MJBEev0PVbchBeTaUbGXFu0LuamiQo

To claim this, I am signing this object:

@scjudd
scjudd / OptionTree.elm
Created September 28, 2016 21:03
A neat little recursive data structure I'm using in an Elm project.
module OptionTree exposing (..)
type Node meta a
= Tree meta (List (Node meta a))
| OneOf (List a)
| ManyOf (List a)
@scjudd
scjudd / Auth.elm
Last active December 1, 2019 16:36
Authentication in Elm
module Auth exposing (User(..), UserInfo, LoginInfo, loginTask)
import HttpBuilder exposing (..)
import Json.Encode as Encode
import Json.Decode as Decode exposing ((:=))
import Task exposing (Task)
type User
= Authenticated UserInfo