Skip to content

Instantly share code, notes, and snippets.

View rendon's full-sized avatar
🧑‍🔬
Trying new things out.

Rafael Rendón rendon

🧑‍🔬
Trying new things out.
View GitHub Profile
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 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
@gazoombo
gazoombo / .tmux.conf
Created January 27, 2012 18:46
vim keybindings for tmux
# 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
@jch
jch / rack_boot.rb
Created April 30, 2012 05:16
Programmatically start a rack app
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
@tnoda
tnoda / naive-primes.clj
Created July 1, 2012 14:51
Sieve of Eratosthenes in Clojure
(defn prime? [n]
(every? #(pos? (rem n %)) (range 2 (Math/sqrt (inc n)))))
(defn naive-primes [n]
(filter prime? (range 2 (inc n))))
@ondrejbartas
ondrejbartas / gist:3526110
Created August 30, 2012 10:45
Make sessions work in Rack::Test with Sinatra's sessions
# 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
@thibautsacreste
thibautsacreste / rack_show_session.rb
Last active March 12, 2021 13:43
Ruby: decode rack session cookie
require 'base64'
require 'cgi'
def show_session(cookie)
Marshal.load(Base64.decode64(CGI.unescape(cookie.split("\n").join).split('--').first))
end
@mapix
mapix / xinitrc
Created January 28, 2013 02:10
xinitrc for multi-monitor display in i3-wm
#!/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
@robcowie
robcowie / .mpdconf
Last active June 8, 2023 16:12
Install mpd on OSX 10.8
## ~/.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"
@hSATAC
hSATAC / gist:5343225
Created April 9, 2013 05:38
Http Redirect in Golang
package main
import (
"log"
"net/http"
)
func redirect(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "http://www.google.com", 301)
@theotherian
theotherian / ClientFactory.java
Last active July 23, 2020 11:21
configuring Jersey 2 client
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import org.apache.http.HttpHost;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.glassfish.jersey.apache.connector.ApacheClientProperties;
import org.glassfish.jersey.apache.connector.ApacheConnector;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;