Skip to content

Instantly share code, notes, and snippets.

View rares's full-sized avatar
🌑

(╯°□°)╯︵ ┻━┻ rares

🌑
View GitHub Profile

Setup tor proxy on Arch Linux

Copied from this article.

Installation

  1. Install tor

         $ sudo pacman -S tor
         $ ## nyx provides a terminal status monitor for bandwidth usage, connection details and more.

$ sudo pacman -S nyx

@elmer-garduno
elmer-garduno / RMQReceiver.scala
Created September 6, 2013 03:01
RabbitMQ Actor with Receiver
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@Peksa
Peksa / MetricsPlugin.java
Created July 29, 2012 15:38
Codahale metrics with Play framework
package plugins;
import play.PlayPlugin;
import play.mvc.Http;
import play.mvc.Http.Request;
import play.mvc.Http.Response;
import play.mvc.Router.Route;
import play.vfs.VirtualFile;
import util.MetricsUtil;
@leedm777
leedm777 / tap.cpp
Created June 22, 2012 19:42
tap implementation for C++11
/** tap implementation for C++11 */
template<typename T, typename F>
T tap(T &&obj, F const &fn) {
fn(obj);
return obj;
}
// usage
tap(new User(params), [](User *u) {
if (u->isValid()) {
@tobyhede
tobyhede / postsql.sql
Created May 17, 2012 03:08
PostgreSQL as JSON Document Store
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--
@zolrath
zolrath / gist:2305333
Created April 4, 2012 20:27
tmux status line from wemux example.

For a tmux status line as seen in the example image for the wemux project: wemux

The session on the left in the example screen shot uses a patched font from the vim-powerline project. Inconsolata-dz, you beautiful creature.

To duplicate the left status line add the following lines to your ~/tmux.conf

set -g status-left-length 32
set -g status-right-length 150
@travisjeffery
travisjeffery / .vimrc
Created February 23, 2012 09:17
Find Rails Partial References
function! GrepPartial(partial)
if (a:partial)
let pattern = "partial.*" . partial
else
let path = substitute(expand("%:h"), "app/views/", "", "")
let action = substitute(expand("%:t:r:r"), "^_", "", "")
let pattern = "partial.*" . path . "/" . action
endif
if (exists('g:loaded_fugitive'))
@ryandotsmith
ryandotsmith / event_buffering.md
Created February 14, 2012 04:10
event buffering

Event Buffering

Eventually platforms outgrow the single-source-tree model and become distributed systems. A common pattern in these distributed systems is distributed composition via event buffering. Here we motivate and describe this event buffering pattern.

The Problem

anonymous
anonymous / bogo.rb
Created February 10, 2012 00:45
class Calculator::Bogo < Calculator
preference :number_to_buy, :integer, :default => 1
preference :number_to_get, :integer, :default => 1
def self.description
"Buy One Get One"
end
def self.register
super

On Failure and Flow

It was so simple. All you wanted was a local copy of your browser history so you could read offline. So you hacked up a script and it worked pretty well. But there were gaps. Sometimes pages didn't work by the time you tried to download them. Sometimes the server errored out. Once, the jerk next door dug up a cable line and your net connection went down entirely.

Errors are going to happen, so how do you handle them in code?