Skip to content

Instantly share code, notes, and snippets.

@fallwith
fallwith / gist:9383650
Created March 6, 2014 06:37
rubyctags - Bash script for generating an Exuberant Ctags file for a Ruby project
#!/usr/bin/env bash
# Generate an Exuberant Ctags file for a Ruby project
#
# - Accepts an optional argument of the starting search directory or file.
# - The starting path will be walked up until either a tags file or other
# project root indicating file/dir can be found.
tags_file=.tags
declare -a root_markers=(.git .hg .svn .bzr _darcs)
@fallwith
fallwith / vim_guide.md
Last active May 18, 2018 03:56
Fallwith's Vim Guide

Vim Guide

2014-2018 by fallwith

Legend

sequence meaning
<C-a> Ctrl + a
\ Shift + v
@fallwith
fallwith / gist:b2d51706747937cbf5ea
Created September 25, 2014 22:30
Upgrade Bash from source in response to shellshock
#!/bin/sh
# build and install a fully patched bash 4.3 to mitigate shellshock
#
# to determine vulnerability:
# %> env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
mkdir bash_src
cd bash_src
wget http://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz
@fallwith
fallwith / figleter.sh
Last active May 18, 2018 01:31
Call figlet with every font using the same input string
#!/usr/bin/env bash
string="$*"
if [ -z "$string" ]; then
echo "Usage: $0 <string>"
exit -1
fi
fonts="3-d 3x5 5lineoblique acrobatic alligator alligator2 alphabet avatar banner banner3 banner3-D banner4 barbwire basic bdffonts/ bell big bigchief binary block broadway bubble bulbhead calgphy2 caligraphy catwalk chunky coinstak colossal computer contessa contrast cosmic cosmike crawford cricket cursive cyberlarge cybermedium cybersmall decimal diamond digital doh doom dotmatrix double drpepper dwhistled eftichess eftifont eftipiti eftirobot eftitalic eftiwall eftiwater epic fender fourtops fraktur fuzzy goofy gothic graceful gradient graffiti hex hollywood invita isometric1 isometric2 isometric3 isometric4 italic ivrit jazmine jerusalem katakana kban l4me larry3d lcd lean letters linux lockergnome madrid marquee maxfour mike mini mirror mnemonic morse moscow mshebrew210 nancyj nancyj-fancy nancyj-underlined nipples ntgreek nvscript o8 octal ogre os2 pawp peaks pebbles pepper poison puffy pyramid rectangle
@fallwith
fallwith / names.c
Last active March 1, 2018 01:16
Parallel processing examples
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
void *greet(void *name_ptr) {
sleep(1);
printf("Hello, %s\n", name_ptr);
return NULL;
}
@fallwith
fallwith / mp4it.sh
Last active January 15, 2019 00:48
ffmpeg sweet spot settings for x265
#!/usr/bin/env bash
set -euo pipefail
NAME=mp4it
VERSION=0.0.12
#
# mp4it
#
# ffmpeg front-end to take an input source (likely in mkv or m2ts format)
# and produce an h.265 formatted mp4 output file at the given location
@fallwith
fallwith / cafmpeg
Created December 3, 2018 23:10
Run caffeinate for the duration of an ffmpeg process
#!/usr/bin/env bash
set -euo pipefail
ffmpeg_pid=$(ps auwx | grep ffmpeg | grep -v grep | awk '{print $2}')
if [ "$ffmpeg_pid" == "" ]; then
echo "Cannot find an ffmpeg pid!"
exit -1
fi
@fallwith
fallwith / colortest24bit.sh
Created January 13, 2019 22:00
Colors and images in the terminal
#!/bin/bash
# This file was originally taken from iterm2 https://github.com/gnachman/iTerm2/blob/master/tests/24-bit-color.sh
#
# This file echoes a bunch of 24-bit color codes
# to the terminal to demonstrate its functionality.
# The foreground escape sequence is ^[38;2;<r>;<g>;<b>m
# The background escape sequence is ^[48;2;<r>;<g>;<b>m
# <r> <g> <b> range from 0 to 255 inclusive.
# The escape sequence ^[0m returns output to default
@fallwith
fallwith / gruvbox-dark.conf
Created March 18, 2019 07:45
Kitty terminal emulator colorschemes
# gruvbox-dark colorscheme for kitty
# snazzy theme used as base
# https://gist.github.com/lunks/0d5731693084b2831c88ca23936d20e8
foreground #ebdbb2
background #272727
selection_foreground #655b53
selection_background #ebdbb2
url_color #d65c0d
@fallwith
fallwith / view.rb
Created June 20, 2019 00:49
View - a simple terminal image viewer
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'base64'
#
# View is a simple terminal image viewer
#
# NOTE: currently only iTerm is supported
#