Skip to content

Instantly share code, notes, and snippets.

@burningTyger
burningTyger / autossh.service
Last active October 18, 2015 19:56 — forked from thomasfr/autossh.service
Systemd service for autossh
# use this if you have a systemctl --user script. Runs it as a user.
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
require "delegate"
module X
def initialize(*)
super
__getobj__.class.instance_methods(false).each do |meth|
define_singleton_method(meth) { __getobj__.send(meth) || "Is nil"}
end
end
end
call plug#begin('~/.vim/plugged')
Plug 'kien/ctrlp.vim'
Plug 'ervandew/supertab'
Plug 'scrooloose/syntastic'
Plug 'bronson/vim-trailing-whitespace'
Plug 'bling/vim-airline'
Plug 'airblade/vim-gitgutter'
Plug 'slim-template/vim-slim'
Plug 'pangloss/vim-javascript'
left:
++ dirname powerline.sh
+ export TMUX_POWERLINE_DIR_HOME=.
+ TMUX_POWERLINE_DIR_HOME=.
+ source ./config/helpers.sh
+ source ./config/paths.sh
++ export TMUX_POWERLINE_DIR_LIB=./lib
++ TMUX_POWERLINE_DIR_LIB=./lib
++ export TMUX_POWERLINE_DIR_SEGMENTS=./segments
@burningTyger
burningTyger / h.rb
Created January 3, 2013 16:41
Here you have multi-key lookup for Ruby. Original idea by @txustice: https://twitter.com/txustice/status/286790996438683648 I can actually think of use cases :-) If you know a better way for dealing with that return value let me know.
class Hash
alias_method :original, :[]
def [](*keys)
keys.uniq!
if keys[1]
keys.map { |key| original key }
else
original keys[0]
end
end

#Here is how I keep my secrets out of my source code when working with OpenShift

  1. find your app's ssh address:

    rhc app show YOUR_APP_NAME

  2. ssh into your gear to set your environment variables:

    ssh YOUR_APPS_SSH_URL

@burningTyger
burningTyger / gist:5581863
Created May 15, 2013 05:42
Sinatra style sheet generation route
# sass style sheet generation
get '/css/:file.css' do
halt 404 unless File.exist?("views/#{params[:file]}.scss")
time = File.stat("views/#{params[:file]}.scss").ctime
last_modified(time)
scss params[:file].intern
end
# Turn DD-WRT wireless radio on for business hours only. Verify wireless interface for your router model.
# Place in WebUI > Administration > Management > Cron
0 18 * * 1,2,3,4,5 root wl -i eth1 radio off
0 6 * * 1,2,3,4,5 root wl -i eth1 radio on
@burningTyger
burningTyger / exif_rename
Created January 9, 2014 14:40
quickly rename JPG to my preferred file format based on exif data
for i in *.JPG; do exiv2 -v -r '%Y-%-m-%d_%H-%M%-%S' rename "$i"; done
#set-option -g default-terminal "screen-256color"
#set -g default-terminal "screen-256color"
set -g mode-mouse on
set-window-option -g mode-mouse on
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix