Skip to content

Instantly share code, notes, and snippets.

View travis-g's full-sized avatar
🎲
rolling dice

Travis Grammer travis-g

🎲
rolling dice
View GitHub Profile
@travis-g
travis-g / ncmpcpp.md
Created January 6, 2019 04:06
Cheat Sheet for ncmpcpp

ncmpcpp Cheat Sheet

Movement

  • Up k - Move cursor up
  • Down j - Move cursor down
  • [ - Move cursor up one album
  • ] - Move cursor down one album
  • { - Move cursor up one artist
  • } - Move cursor down one artist
@travis-g
travis-g / whatthecommit.sh
Last active February 20, 2023 01:02
Commit message generator based on whatthecommit.com
#!/usr/bin/env sh
usage() {
cat <<EOF
whatthecommit.sh - an offline commit message generator based on whatthecommit.com
usage: $(basename $0) [-h]
-h print this help
example:
@travis-g
travis-g / randomizer.coffee
Created December 30, 2021 01:36
Fallout 4 Challenge Run Generator
@this = "Fallout 4 Challenge Run Generator"
@me = "/u/travis-g"
@license = "WTFPL2, but I'd love a mention"
@about = """
#{@this}
Made by #{@me}
Started as just the trash() function, but it got bigger when I thought of a
use for it. I've put hundreds of hours into Skyrim and Fallout games just by
running character/challenge builds. I've never finished the main questlines.
@travis-g
travis-g / font-face.css
Last active January 21, 2021 07:57
Possible Emoji @font-face rule
@font-face {
font-family: 'emoji';
src:
local('Apple Color Emoji');
local('Noto Color Emoji');
local('Android Emoji');
local('Segoe UI');
local(EmojiSymbols);
unicode-range:
U+1f300-1f5ff, /* misc symbols + pictographs */
@travis-g
travis-g / pi.md
Last active February 20, 2020 03:18
Various notes

Discovery

Discover IP of Pi with ARP lookup, limiting results returned to MAC addresses that match the Raspberry Pi Foundation's assigned range (B8:27:EB:XX:XX:XX):

arp -a | Select-String -Pattern "b8.27.eb"
arp -a | grep -i "b8.27.eb"
from PIL import Image
import json
import requests
h = 1000
w = 1000
# PIL accesses images in Cartesian co-ordinates, so it is Image[columns, rows]
img = Image.new( 'RGB', (h,w), "black") # create a new black image
pixels = img.load() # create the pixel map
@travis-g
travis-g / main.tf
Created February 15, 2020 02:46
Boilerplate Terraform S3 backend code
terraform {
backend "s3" {
bucket = ""
region = "us-east-1"
encrypt = true
acl = "private"
key = ""
}
}
digraph G {
rankdir=LR;
subgraph cluster_vault {
label = "Vault (Meta Storage Backend)";
style=filled
color=lightgrey
node [style=filled,color=white]
"ipfs/ipfs-docs" [style=dashed color=normal]
@travis-g
travis-g / data2hist.py
Last active November 9, 2019 21:21
Converts data from stdin to histogram bins
#!/usr/bin/env python3
import sys
import argparse
import datetime
import numpy as np
import pandas as pd
parser = argparse.ArgumentParser()
parser.add_argument("--log", help="logarithmically scale results", action="store_true")
parser.add_argument("-s", "--size", help="number of bins", action="count", default=40)
@travis-g
travis-g / ffmpeg.md
Last active January 26, 2019 05:28
ffmpeg Conversions
#!/bin/bash
TYPE=${1:-no type provided}

for FILE in $(ls *.${TYPE} | tr -d "'")
do
    # Get 0-based index of English subtitle stream
    INDEX=$(($(ffprobe -loglevel error -select_streams s -show_entries stream=index:stream_tags=language -of csv=p=0 $FILE | sed -n '/eng/=')-1))
    # Convert
    ffmpeg -y \