Skip to content

Instantly share code, notes, and snippets.

View BrandonRomano's full-sized avatar

Brandon Romano BrandonRomano

View GitHub Profile

vcompress

Include this in your bashrc / bash_profile:

function vcompress() {
    local base="$(basename "$1" .mp4)"
    ffmpeg \
      -i "$1" \
 -vf 'scale=if(gte(iw\,ih)\,min(1580\,iw)\,-2):if(lt(iw\,ih)\,min(1580\,ih)\,-2)' \
@BrandonRomano
BrandonRomano / aseprite-compile.sh
Last active May 31, 2021 01:37
Aseprite Compile
#!/bin/bash
# Compiles an entire directory of .aseprite files
# down to PNGs in another directory.
#
# $1: The input directory (aseprite files)
# $2: The output directory (pngs)
#
# If you're not on a standard Mac install, you can overwrite
# ASEPRITE_PATH as an environment variable pointing to your
# aseprite command.
@BrandonRomano
BrandonRomano / optimizing-videos.md
Last active January 21, 2020 13:08
Optimizing Videos

Depends on ffmpeg (brew install ffmpeg)

Copy & Paste this function into your terminal:

function optimize() {
	ffmpeg -i "$1" -vcodec libx264 -crf 24 "${1%.*}_optimized.${1#*.}"
}
#<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
#<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
#<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
#<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
#<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
#<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
#<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
#<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
#<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
#<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
@BrandonRomano
BrandonRomano / watch.sh
Created January 3, 2017 14:07
Watch a directory + execute a command on update
#!/bin/bash
#
# This script will watch a directory, and execute an arbitrary
# command when there is a change to a file within it.
#
# @param $1: The directory to watch for any changes
# @param $2: The command to run when there is a change
##################################################
current_md5=""
@BrandonRomano
BrandonRomano / watch.sh
Created January 3, 2017 14:07
Watch a directory + execute a command on update
#!/bin/bash
#
# This script will watch a directory, and execute an arbitrary
# command when there is a change to a file within it.
#
# @param $1: The directory to watch for any changes
# @param $2: The command to run when there is a change
##################################################
current_md5=""
sftp_user=""
sftp_host=""
deploy() {
local write_file="sftp-commands-$(date +%s).txt"
generate_command_file > "$write_file"
cat "$write_file" | sftp "$sftp_user"@"$sftp_host"
rm "$write_file"
}
@BrandonRomano
BrandonRomano / gist:0e3f2478539043887569
Last active August 29, 2015 14:07
Find deleted Github tags
last_issue=""
github_token=""
$repo_owner=""
$repo_name=""
deleted_tag=""
output_file=""
for i in $(eval echo {1..$last_issue})
do
comp=$(curl --header "Authorization: token $github_token" \