This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"net/http" | |
) | |
func redirect(w http.ResponseWriter, r *http.Request) { | |
http.Redirect(w, r, "http://www.google.com", 301) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ~/.mdpconf | |
port "6600" | |
music_directory "~/Music/" | |
playlist_directory "~/.mpd/playlists" | |
db_file "~/.mpd/mpd.db" | |
log_file "~/.mpd/mpd.log" | |
pid_file "~/.mpd/mpd.pid" | |
state_file "~/.mpd/state" | |
#bind_to_address "~/.mpd/mpd.sock" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# ~/.xinitrc | |
# Executed by startx (run your window manager from here) | |
# Set up screens and set background | |
if [ `xrandr | grep -c ' connected '` -eq 2 ]; then # dual-monitor | |
if [ `xrandr | grep VGA-1 | grep -c ' connected '` -eq 1 ]; then | |
xrandr --output LVDS-1 --auto --primary --output VGA-1 --auto --right-of LVDS-1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'base64' | |
require 'cgi' | |
def show_session(cookie) | |
Marshal.load(Base64.decode64(CGI.unescape(cookie.split("\n").join).split('--').first)) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this in your test helper file | |
# This works when using the default Sinatra sessions (i.e. enable :sessions) | |
# (helper preamble not included) | |
require 'securerandom' | |
class Test::Unit::TestCase | |
include Rack::Test::Methods | |
def app | |
Sinatra::Application # or the name of your modular app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn prime? [n] | |
(every? #(pos? (rem n %)) (range 2 (Math/sqrt (inc n))))) | |
(defn naive-primes [n] | |
(filter prime? (range 2 (inc n)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rack' | |
class RackApp | |
def self.call(env) | |
[200, {'Content-Type' => 'text/html'}, ['derp']] | |
end | |
end | |
# For a full list of options, see | |
# http://www.ruby-doc.org/stdlib-1.9.3/libdoc/webrick/rdoc/WEBrick.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I'm a Vim user, this makes navigation easier | |
setw -g mode-keys vi # I especially like being able to search with /,? when in copy-mode | |
unbind-key j | |
bind-key j select-pane -D # Similar to 'C-w j' to navigate windows in Vim | |
unbind-key k | |
bind-key k select-pane -U | |
unbind-key h | |
bind-key h select-pane -L | |
unbind-key l | |
bind-key l select-pane -R |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0 is too far from ` ;) | |
set -g base-index 1 | |
# Automatically set window title | |
set-window-option -g automatic-rename on | |
set-option -g set-titles on | |
#set -g default-terminal screen-256color | |
set -g status-keys vi | |
set -g history-limit 10000 |
NewerOlder