Skip to content

Instantly share code, notes, and snippets.

View linkleonard's full-sized avatar

Leonard Law linkleonard

View GitHub Profile
@linkleonard
linkleonard / add-sublime-to-context-menu-windows.bat
Created October 29, 2015 01:19
Script to add a context menu entry for Sublime text on Windows.
:: Add a context menu entry for "quick editing" files from Windows Explorer.
:: Original work: http://wordpress-corner.com/add-open-sublime-text-3-windows-explorer-context-menu/
:: Usage instructions:
:: 1. Make sure sublime text is installed.
:: 2. Edit this file so that set2Path points to the location of the
:: Sublime text executable.
:: 3. Run this file as an Administrator.
@linkleonard
linkleonard / .profile
Created October 29, 2015 16:26
Custom OSX .profile
# Custom OSX .profile
# Set default editor to emacs
export EDITOR=emacs
# Specify a custom prompt. This is linux mint-ish.
export PS1="\[\]\u@\h\[\]:\[\]\w\[\]$\[\] "
@linkleonard
linkleonard / expand.sh
Created November 5, 2015 21:42
Expand tabs to 4 spaces in all *.html, *.css, *.js files in the current directory tree.
find -E . -regex ".*\.(html|css|js) ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
@linkleonard
linkleonard / atom-update.sh
Created March 3, 2016 20:55
Atom update script
#!/bin/bash
# Based on http://askubuntu.com/a/630530
wget -q https://github.com/atom/atom/releases/latest -O /tmp/latest
wget -q https://github.com$(grep -E 'href=".*atom-amd64.deb' /tmp/latest --only | sed -e 's/href="//') -O /tmp/atom-amd64.deb
sudo dpkg -i /tmp/atom-amd64.deb
@linkleonard
linkleonard / script.bash
Created March 22, 2016 22:18
GNU find cheatsheet
#!/bin/bash
# Find all files ending in "*.py", but exclude the ./venv directory
find . -path ./venv -prune -o -name '*.py' -print
@linkleonard
linkleonard / readme.md
Created March 25, 2016 15:20
Preparing Gnome Terminal for oh-my-zsh themes on Ubuntu

Install powerline fonts

https://github.com/powerline/fonts

Gnome Terminal configuration

Set font to one of the fonts in Powerline i.e. Droid Sans Mono Slashed for Powerline

Probably set the color palette. Linux console works well.

@linkleonard
linkleonard / clean-requirements.py
Created April 15, 2016 20:20 — forked from temoto/clean-requirements.py
Helper to clean requirements.txt from unused dependencies
#!/usr/bin/env python
from __future__ import print_function
import argparse
import collections
import re
import subprocess
import sys
KNOWN_IMPORT_PACKAGE_MAP = {
@linkleonard
linkleonard / convert.bat
Created May 31, 2016 05:36
Convert file from OBS FLV to MP4 format for editing in Sony Vegas Pro
# Convert file from OBS FLV to MP4 format for editing in Sony Vegas Pro
ffmpeg -threads 0 -i [input-file.flv] -vcodec copy [output-file.mp4]
@linkleonard
linkleonard / init-ubuntu.sh
Last active February 6, 2017 20:06
Initialize Ubuntu for my use.
#!/bin/bash
# Tested on Ubuntu 16.04.1 Desktop
sudo apt-get install -y \
open-vm-tools open-vm-tools-desktop \
tmux \
git \
python3-pip
PIP=pip3