Skip to content

Instantly share code, notes, and snippets.

@Perlence
Perlence / tmux.conf
Created April 30, 2016 15:23
Super minimal tmux.conf
set -g default-shell /usr/bin/fish
set -g default-command /usr/bin/fish
set -g default-terminal screen-256color
@Perlence
Perlence / basic_usage.py
Created February 18, 2016 14:28
Basic usage of PocketSphinx via Python
from __future__ import print_function
from os import path
from sphinxbase import sphinxbase # noqa
from pocketsphinx import pocketsphinx
MODELDIR = "pocketsphinx/model"
DATADIR = "pocketsphinx/test/data"
# Create a decoder with certain model
@Perlence
Perlence / prosody-entrypoint.sh
Created February 11, 2016 12:58
Using envsubst with Docker in entrypoint
#!/bin/bash
set -e
# Substitute environment variables in Prosody configs
for tpl in /etc/prosody/*.tpl; do
envsubst < $tpl > ${tpl%\.tpl}
done
exec su -s /bin/bash -c "$*" prosody
@Perlence
Perlence / mrename.py
Created January 1, 2016 12:51
Rename multiple files
#!/usr/bin/env python2
import glob
from itertools import takewhile
import os
import subprocess
import sys
import tempfile
EDITOR = 'c:\\Program Files\\Sublime Text 3\\sublime_text.exe'
@Perlence
Perlence / getclip.py
Created December 29, 2015 20:49
Print contents of the clipboard
from Tkinter import Tk
r = Tk()
r.withdraw()
print r.clipboard_get()
r.destroy()
@Perlence
Perlence / solarized-dark.reg
Created December 23, 2015 22:36
Solarized Dark theme for Windows Command Processor with reduced base colors
Windows Registry Editor Version 5.00
; Registry file that maps the solarized palette to the 16 avaliable colors
; in a Windows command prompt. Note, hex values in the table are RGB but byte
; ordering of a DWORD is BGR, e.g. "ColorTable<##>"=dword:00<B><G><R>
;
; Solarized color table from http://ethanschoonover.com/solarized.
;
; NR cmd.exe PowerShell SOLARIZED HEX DWORD
; -- ------- ----------- --------- ------- --------
@Perlence
Perlence / concurrent-youtube-dl.fish
Last active December 24, 2015 09:13
Download a batch of YouTube videos concurrently
youtube-dl -a - -i -o ' out=%(uploader)s/%(id)s %(title)s.%(ext)s' -g --get-filename --cookies .cookies \
< all-bookmarks.txt \
^ youtube-dl.log \
| aria2c -c -j 6 -x 6 -s 6 -k 1M --load-cookies=.cookies -i - --deferred-input=true \
^ aria2c.log
@Perlence
Perlence / byobu.txt
Last active December 23, 2015 20:09
Byobu help
┌────────────────────────────┤ Byobu Help ├─────────────────────────────┐
│ │
│ Byobu is a suite of enhancements to tmux, as a command line │
│ tool providing live system status, dynamic window management, │
│ and some convenient keybindings: │
│ │
│ F1 * Used by X11 * │
│ Shift-F1 Display this help │
│ F2 Create a new window │
│ Shift-F2 Create a horizontal split │
@Perlence
Perlence / autorun.inf.bat
Created December 17, 2015 17:15
Protect autorun.inf
:: Copy this file to the root of the flash memory and then run it
md autorun.inf
cd autorun.inf
md -..\
:: Now, to delete the folder autorun.inf format the flash memory
@Perlence
Perlence / closingqueue.py
Created December 3, 2015 20:37
A subclass of asyncio.Queue with close() method
"""closingqueue.py
Inspired by `pychan <https://github.com/stuglaser/pychan>`_.
"""
import asyncio
class ClosingQueue(asyncio.Queue):
"""A subclass of Queue with close() method.