Skip to content

Instantly share code, notes, and snippets.

@sprig
sprig / gist:9322b0bc530a87be1357462d78c63283
Created August 18, 2017 06:18 — forked from ingramchen/gist:e2af352bf8b40bb88890fba4f47eccd0
ffmpeg convert gif to mp4, for best cross browser compatibility
### Full command line options
```
ffmpeg -f gif -i FOO.gif -pix_fmt yuv420p -c:v libx264 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' BAR.mp4
```
### Notie
* output mp4 is encoded with h264, support Firefox/Chrome/Safari in Windows, Mac OSX, Android, and iOS.
@sprig
sprig / convertBibDeskLinks.m
Created July 2, 2016 15:08 — forked from wildmichael/convertBibDeskLinks.m
Converts the Bdsk-File-X base64 encoded aliases created by BibDesk to normal file paths
@sprig
sprig / sort.py
Created June 13, 2016 23:13 — forked from rbonvall/sort.py
#!/usr/bin/env python3.0
import sys, array, tempfile, heapq
assert array.array('i').itemsize == 4
def intsfromfile(f):
while True:
a = array.array('i')
a.fromstring(f.read(4000))
if not a:
@sprig
sprig / EmacsClient.applescript
Created March 31, 2016 06:52
Receive URLs or files and forward them to emacsclient in OSX.
set emacsclient to "/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9/emacsclient -n -c -a \"/Applications/Emacs.app/Contents/MacOS/Emacs\""
on open location input
do shell script emacsclient & "\"" & input & "\""
end open location
on open inputs
repeat with raw_input in inputs
set input to POSIX path of raw_input
do shell script emacsclient & "\"" & input & "\""
@sprig
sprig / .README.md
Created September 10, 2013 19:57 — forked from tarruda/.README.md

Some scripts/configurations that greatly improve tmux/vim workflows. The shell scripts target zsh but should be adaptable without much effort for other unix shells.

Features:

  • Transparently move between tmux panes and vim windows
  • Using the shell, open files in one vim instance per project or directory
  • Fully integrated copy/paste between tmux, vim and x11 using simple keybinds(need to install the xclip program)
  • Easily send text to any tmux pane without breaking your edit workflow(needs slimux

'vim-tmux-move.zsh', '.vimrc' and '.tmux.conf' cooperate so you can move transparently between tmux panes and vim windows using ALT + (arrow keys or jkhl). It was based on this gist

@sprig
sprig / select-session.sh
Last active December 21, 2015 21:08
Select a tmux session from a given server and attach to it.
## Select a tmux session from a given tmux server and attach to it.
TSERVER=$1
SSTRING=$(if [ $TSERVER ]; then echo "-L $TSERVER"; else echo ""; fi)
SESSIONS=$(tmux $SSTRING ls|sed -E 's/^(.*?): .*/\1/'|xargs echo)
TSERVER=$(if [ $TSERVER ]; then echo $TSERVER; else echo "the default server"; fi)
echo "Available sessions on $TSERVER:"
select opt in $SESSIONS "Quit"; do
case $opt in
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Topmenu and the submenus are based of the example found at this location http://blog.skeltonnetworks.com/2010/03/python-curses-custom-menu/
# The rest of the work was done by Matthew Bennett and he requests you keep these two mentions when you reuse the code :-)
# Basic code refactoring by Andrew Scheller
import curses, os #curses is the interface for capturing key presses on the menu, os launches the files
screen = curses.initscr() #initializes a new window for capturing key presses
curses.noecho() # Disables automatic echoing of key presses (prevents program from input each key twice)
curses.cbreak() # Disables line buffering (runs each key as it is pressed rather than waiting for the return key to pressed)
@sprig
sprig / reinstall-tree
Created July 20, 2013 17:48
Reinstall the whole tree a given package depends on.
#!/bin/bash
set -o errexit
## Some packages kill the proces sdue to cyclic dependencies, etc.
IGNORE="<[-.a-zA-Z0-9]*> dpkg perl-base libaudit1 libdb5.1"
## User entered packages to search dependencies for.
DEPS=$@
@sprig
sprig / pextend.sh
Last active December 19, 2015 14:18
Add a given path component to a given path variable
## Add a given path component ($2) to the given path variable ($1).
pextend ()
{
local pvar=$1
local p=$(eval "echo \$$pvar")
local dname=$2
if [ -d $dname ] ; then
case $p in
*${dname}* ) return ;;
* ) eval "${pvar}=\"${dname}:${p}\"" ;;
* Generate classes like WhereNot automatically with class decorator?
* Haskell style deconstruction, perhaps like:
@pmatch
def count(first_arg=Match(x=Head, *xs=Rest)):
print x, xs
Will require some nasty hacks like https://github.com/smcq/python-inject
* Implement boolean operators for stuff like:
@pmatch