Skip to content

Instantly share code, notes, and snippets.

View mtking2's full-sized avatar
🏠
Working from home

Michael mtking2

🏠
Working from home
View GitHub Profile
@mtking2
mtking2 / npm-init.md
Last active February 13, 2020 21:39
npm init
@mtking2
mtking2 / suppress_output.rb
Created October 2, 2018 17:07
Suppress Output Ruby wrapper
# This wrapper method helps to suppress any unnecessary output
# from stdout or stderr when executing a block of code.
#
# Reminder: any print/puts statements within the given block will
# also be suppressed since they go to stdout.
#
# usage: suppress_output <block>
#
# eg:
# suppress_output { ... }
@mtking2
mtking2 / gitsync.md
Last active August 30, 2019 21:15
Git Upstream/Origin Sync

Git Upstream/Origin Sync

This script will sync your origin with upstream master, whether you're currently on master or checked-out on a working branch.

If you don't have an upstream remote then it will just pull and push to origin accordingly.

Just throw this in a file somewhere, chmod 755 that bad boy, and then export PATH="path/to/script:$PATH" in your favorite ~/.rc file to run from anywhere.

Breakdown of commands for various cases

@mtking2
mtking2 / apod.md
Last active September 1, 2022 23:40
NASA APOD wallpaper script

NASA APOD wallpaper for Unix systems

script

Save to a file wherever it please you (I saved it to ~/scripts/apod.sh)
Maybe make sure it is executable: chmod 755 ~/scripts/apod.sh

#!/bin/bash
# apod.sh
@mtking2
mtking2 / gifenc
Last active November 17, 2017 19:01
GIF encoder w/ ffmpeg
#!/bin/sh
# convert input.mov to 720px wide gif at 30fps
# ./gifenc input.mov output.gif 720 30
palette="/tmp/palette.png"
filters="fps=$4,scale=$3:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette