Skip to content

Instantly share code, notes, and snippets.

View travismiller's full-sized avatar

Travis Miller travismiller

View GitHub Profile
@travismiller
travismiller / DefaultMailSwitcher.swift
Created January 23, 2024 15:56
DefaultMailSwitcher
// DefaultMailSwitcher.swift
// https://apple.stackexchange.com/a/455015
import Cocoa
// https://stackoverflow.com/a/59357395/1596013
class StandardError: TextOutputStream {
func write(_ string: String) {
try! FileHandle.standardError.write(contentsOf: Data(string.utf8))
}
@travismiller
travismiller / copy_pasta.rb
Created September 8, 2023 17:24
copy_pasta.rb
# frozen_string_literal: true
## Usage:
##
## $ irb -r './copy_pasta'
## irb(main):001:0> CopyPasta.pbpaste
## => "paste from existing clipboard"
## irb(main):002:0> CopyPasta.pbcopy 'a'
## => "a"
## irb(main):003:0> CopyPasta.pbpaste
@travismiller
travismiller / pgdsn
Last active May 11, 2023 16:56
Convert a DSN url to PG environment variables
#!/usr/bin/env bash
## Convert a DSN url to PG environment variables
##
## Usage:
##
## # Use PGDSN environment variable
## $ PGDSN='postgresql://user:pass@host:port/database' pgdsn psql
##
## # Use DATABASE_URL environment variable (PGDSN has priority)
@travismiller
travismiller / .p10k.rtx.zsh
Last active March 31, 2023 20:07
Powerlevel10k prompt segments for rtx
# Powerlevel10k prompt segments for rtx
#
# https://github.com/romkatv/powerlevel10k
# https://github.com/jdxcode/rtx
# [Feature request: add segment for rtx](https://github.com/romkatv/powerlevel10k/issues/2212)
#
# Usage in ~/.zshrc:
#
# # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
# [[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
@travismiller
travismiller / Makefile
Created March 15, 2023 15:15
TPS DEV Team Milestones
# Create milestones for TPS GitHub repositories
#
# References:
#
# - https://docs.github.com/en/rest/issues/milestones#create-a-milestone
#
# Requires:
#
# - ENV: GITHUB_TOKEN
# - curl
@travismiller
travismiller / Dockerfile
Last active December 12, 2022 20:24
Recipe: Docker / compose / node_modules / volumes
FROM node:slim
ENV DEFAULT_PATH "$PATH"
ENV NODE_PATH "/home/node/lib/node_modules"
ENV PATH "/home/node/app/node_modules/.bin:/home/node/lib/node_modules/.bin:$DEFAULT_PATH"
USER node
WORKDIR /home/node/lib
COPY --chown=node package*.json ./
@travismiller
travismiller / install-unity.sh
Last active October 19, 2021 22:47
Install Unity
#!/usr/bin/env bash
set -e
set -x
cd /tmp
sudo apt-get update
sudo apt-get install -y libgconf-2-4 libarchive13 mono-devel libnss3 flatpak
# Find the longest genetic palindromic sequence
# https://en.wikipedia.org/wiki/Palindromic_sequence
# ________
# input: 'ACCTAGGT'
# index: 0
# length: 8
# palindrome: 'TGGATCCA'
@travismiller
travismiller / keybase.md
Created July 23, 2019 21:48
keybase.md

Keybase proof

I hereby claim:

  • I am travismiller on github.
  • I am travismiller (https://keybase.io/travismiller) on keybase.
  • I have a public key ASA_hqKiWgImuQ2IwpvgHkZNUzx170EgPxSL-MFDFdJQ7wo

To claim this, I am signing this object:

# Shell Aliases
## dynamic ssh config
if [ -f ~/.ssh/broco-ssh-config/bash.alias ]; then
source ~/.ssh/broco-ssh-config/bash.alias
fi
## ls
alias ls='ls -G'
alias ll='ls -G -l'