Skip to content

Instantly share code, notes, and snippets.

View ruby-switch
#!/bin/bash
#
# ppa: brightbox/ruby-ng/ubuntu
#
BINS="gem irb rake ruby ri rdoc erb"
VERS="1.9 1.9.1 2.0 2.1 2.2 2.3"
function display_alternatives() {
update-alternatives --display ${1:?"bin name"}
View razer_rgb.py
#!/usr/bin/env python
import os
import math
from numpy import interp
from random import choice, sample
from time import sleep
from math import log1p
# from colour import Color
View .bash_aliases
#!/bin/bash
export LANG="en_US.UTF-8"
export LANGUAGE="en_US"
txtrst='\033[00m' # Text Reset (\e[0m')
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
View i3status
#
# i3 `status_command` config
#
# @author emiller
# @date 2014-09-09
#
general {
interval = 5
colors = true
View i3config
#
# i3 config
#
# Written under the assumption that capslock is rebound via
# the following .Xmodmap config:
#
# clear mod3
# clear lock
# remove mod1 = Hyper_L
# remove mod2 = Hyper_L
@emiller
emiller / twentyfivesixty-over-hdmi
Last active Dec 29, 2015
Ghetto-fabulous script that sets up a 2560x1440 mode for a laptop's HDMI output, even if it doesn't allow it, and allows toggling usage.
View twentyfivesixty-over-hdmi
#!/bin/bash
#
# twentyfivesixty-over-hdmi -- force an HDMI output to drive 2560x1440
#
# Ghetto-fabulous script that sets up a 2560x1440 mode for an HDMI output
# and allows toggling usage.
#
# I've been using a Dell U2713HM as an external monitor at work with my
# Lenovo Yoga 13, but unfortunately the HDMI port doesn't detect the native
# resolution of the monitor (2560x1440) as a valid output. In fact, all
@emiller
emiller / git-mv-with-history
Last active Jun 20, 2020
git utility to move/rename file or folder and retain history with it.
View git-mv-with-history
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@emiller
emiller / port-route
Last active Dec 24, 2015
Simple utility script that allows you to route incoming TCP traffic on one port to another.
View port-route
#!/bin/bash
#
# port-route -- route one port's traffic to another.
#
# Simple utility that wraps `iptables` to enable routing TCP
# traffic of one port to another.
#
# Usage:
#
# port-route <up|down|show> <source port> <destination port>
@emiller
emiller / proxy
Last active Dec 24, 2015
proxy (socks ssh proxy)
View proxy
#!/bin/bash
#
# proxy -- simple socks proxy for those open wifi networks.
#
# Usage is simple:
#
# proxy <up|down|watch|show|ssh> [alt remote port] [alt remote host]
#
# `proxy up` will create a socks proxy listening locally on 8000 by
# default, through a rhost server via ssh over port 53 (dns/domain).
@emiller
emiller / yoga-auto-rotate
Last active Jun 7, 2020
Lenovo Yoga 13 tablet mode / auto rotation script (ubuntu/debian)
View yoga-auto-rotate
#!/bin/bash
#
# yoga-auto-rotate -- ghetto-style tablet mode, with keyboard and all.
#
# Simple little script that will detect an orientation change for a
# Lenovo Yoga 13 (very hackily) and adjust the active display's
# orientation and disable/enable the touchpad as necessary.
#
# The Yoga 13 will emit keycode `e03e` at one second intervals
# when the screen is flipped into tablet mode. Since this keycode
You can’t perform that action at this time.