Skip to content

Instantly share code, notes, and snippets.

View jamesthomasonjr's full-sized avatar

JT jamesthomasonjr

View GitHub Profile
@jamesthomasonjr
jamesthomasonjr / profile.ps1
Created June 9, 2021 13:55
Powershell profile
function touch {
param([string] $file)
if(test-path $file) {
Set-ItemProperty -Path $file -Name LastWriteTime -Value (get-date)
} else {
Set-Content -Path ($file) -Value ($null);
}
<#
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
<dict>
<key>Comment</key>
<string>Citrus Soda! All of the caffeine with none of the yellow 5!</string>
</dict>
-->
<plist version="1.0">
<dict>
@jamesthomasonjr
jamesthomasonjr / update-copyright.sh
Created February 24, 2020 19:00
Update the copyright only on changed files
@jamesthomasonjr
jamesthomasonjr / environment
Created February 21, 2020 16:32
bash utilities
#!/usr/bin/env bash
# Utility functions for dealing with the environment
source "$(dirname ${BASH_SOURCE[0]})/sanity"
function environment::read {
# @TODO: Check for original allexport setting and return back instead of assuming it's off
set -o allexport
@jamesthomasonjr
jamesthomasonjr / generate-cert
Created February 21, 2020 16:27
Easily Generate & Trust a Self Signed Certificate on OS X
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
# Configuration
# Certifiate TTL
DAYS=3650
# RSA Encryption Bits
BITS=2048
@jamesthomasonjr
jamesthomasonjr / DoctrineObjectNormalizer.php
Created January 31, 2020 16:55
Incomplete Symfony Serializer Normalizer for Doctrine Objects
<?php
namespace Something\Somewhere;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata as ODMClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadata as ORMClassMetadata;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@jamesthomasonjr
jamesthomasonjr / jsxtovanilla.js
Last active December 11, 2019 16:30
Create vanilla DOM objects from JSX
function element(type, newProps, ...children) {
const element = document.createElement(type);
if (newProps) {
Object.entries(newProps).forEach(([key, value]) => {
if (typeof value == 'function') {
element[key] = value;
} else {
element.setAttribute(key, value);
}
@jamesthomasonjr
jamesthomasonjr / resume.json
Last active April 1, 2022 18:40
resume.json
{
"basics": {
"name": "James Thomason, Jr",
"label": "Full Stack Software Engineer",
"picture": "https://avatars.githubusercontent.com/u/691492?s=400&u=0552378d317cc1603b7c39f9e3c652bdcdc09659&v=4",
"email": "james@jamesthomasonjr.com",
"phone": "(810) 214 0123",
"website": "https://jamesthomasonjr.com",
"summary": "I am a Full-Stack Software Engineer who is passionate about engineering, architecture, and tooling. I am looking to fill a T-Shaped position in a team that solves interesting and challenging problems with innovative technology.",
"location": {
@jamesthomasonjr
jamesthomasonjr / spotify.py
Last active September 4, 2019 13:04
Add "Now Playing" information from Spotify to iTerm2 Status Bar
# ~/Library/Application Support/iTerm2/Scripts/AutoLaunch/spotify.py
#
# This script adds a new Status Bar component to iTerm2 that displays now playing information from Spotify
from subprocess import Popen, PIPE
import iterm2
PREFIX = 'PREFIX'
TEMPLATE = 'TEMPLATE'
@jamesthomasonjr
jamesthomasonjr / awsup.fish
Created April 10, 2019 14:54
SAML to AWS STS Keys helper function for Fish
#! /usr/bin/env fish
function _awsup_check_signin --argument-names 'credentials_file'
set --erase --universal AWS_ACCESS_KEY_ID
set --erase --universal AWS_SECRET_ACCESS_KEY
set --export --universal AWS_SHARED_CREDENTIALS_FILE "$credentials_file"
set --local account_name (aws iam list-account-aliases --output text --query 'AccountAliases[0]' 2>/dev/null)
if test -z "$account_name"