Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import sys
import spotipy.util
import iterfzf
def get_api_dict(user, client_id, client_secret):
""" Create the api dict for use by spotify auth """
# make tmux display things in 256 colors
set -g default-terminal 'screen-256color'
set -g terminal-overrides ',xterm-256color:Tc'
set -as terminal-overrides ',xterm*:sitm=\E[3m'
# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
set -s escape-time 50
# Rebind prefix from ctrl+b to ctrl+a
set -g prefix C-a
rofi usage:
rofi [-options ...]
Command line only options:
-no-config Do not load configuration, use default values.
-v,-version Print the version number and exit.
-dmenu Start in dmenu mode.
-display [string] X server to contact.
${DISPLAY}
-h,-help This help message.
rofi usage:
rofi [-options ...]
Command line only options:
-no-config Do not load configuration, use default values.
-v,-version Print the version number and exit.
-dmenu Start in dmenu mode.
-display [string] X server to contact.
${DISPLAY}
-h,-help This help message.
#!/bin/bash
gitpullall() {
# Turn off noclobber in zsh, keep quiet in bash
unsetopt noclobber 2>/dev/null
for i in $(find ~/test_repos -name '.git'|xargs dirname|sort);{
cd "$i"
newfiles=$(git st|grep modified|sed 's/.*: *//')
tmpfile=$(mktemp)
echo '# Uncommented files will be added to commit' >> $tmpfile
@surskitt
surskitt / randFromPlex.py
Last active August 29, 2015 13:56
Get randomised list of films from plex
#!/usr/bin/env python
import requests
from xml.etree import ElementTree
from optparse import OptionParser
from random import sample
# Plex host
host = "127.0.0.1"
# Plex port
@surskitt
surskitt / col2letter.py
Last active December 24, 2015 18:59
Converts an absolute column number to an excel column notation (A - XFD).
def col2letter(col):
if col > 0 and col <= 16384:
a1 = chr((col / 26 ** 2) + 64) * (col > 26 ** 2)
a2 = chr(((col % 26 ** 2) / 26 - (not col % 26)) + 64) * (col > 26)
a3 = chr((col % 26 + (26 * (not col % 26))) + 64)
return ''.join((a1, a2, a3))
@surskitt
surskitt / clockwipe.avsi
Created July 10, 2013 23:13
avisynth: Clockwipe transition function
###############################################################################
# Function that allows for a clockwipe transition between the two input clips #
###############################################################################
Function clockwipe(clip bottom,clip top, int "Duration", float "blurriness")
{
width=bottom.width()
height=bottom.height()
wb=blankclip(bottom,duration,color=$FFFFFF)
@surskitt
surskitt / changeSpeed.avsi
Created July 10, 2013 23:11
avisynth: Change the speed of a clip by a given rate
##################################################
# Function to change the speed of clip c by rate #
##################################################
function ChangeSpeed(clip c, float rate)
{
orig = c.framerate
newvid = AssumeFPS(c, orig * rate)
return ChangeFPS(newvid, c, linear=false)#.AudioDub(c.TimeStretch(tempo=100*rate))
}
@surskitt
surskitt / MCsub.avsi
Created July 10, 2013 19:46
avisynth: Minecraft styled subtitles for owlcraft series
###################################################################
# A function to add minecraft styled subtitles to owlcraft videos #
# TODO: Use SubtitleEX instead #
###################################################################
# Args
# c -> the input clip
# text -> the text to be displayed
# start_in -> the beginning time of the subtitle (in frames)
# end_in -> the end time of the subtitle (in frames)