This file contains 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
from math import sqrt | |
from geopy.distance import great_circle | |
from collections import defaultdict | |
def km(a, b): | |
return great_circle(a, b).km | |
def euc2d(a, b): |
This file contains 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
macm Window.Select\ Next\ Tab key=<nop> | |
nmap <D-}> :bnext<CR> | |
macm Window.Select\ Previous\ Tab key=<nop> | |
nmap <D-{> :bprev<CR> | |
map <D-\|> :blast <CR> | |
map <D-+> :BufExplorer<CR> | |
map <D-S-BS> :bdelete<CR> |
This file contains 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 bfs [sz ef ff] | |
"Initial state sz, expansion function ef [s] and feasibility function ff [s]" | |
(loop [queue (conj clojure.lang.PersistentQueue/EMPTY sz) | |
ef ef | |
ff ff] | |
(if (seq queue) | |
(let [nx (peek queue)] | |
(if (ff nx) nx (recur (into (pop queue) (ef nx)) ef ff))) | |
nil))) |
This file contains 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 'rubygems' | |
require 'json' | |
@products = { | |
1 => { :name => 'A' }, | |
2 => { :name => 'B' }, | |
3 => { :name => 'C' }, | |
4 => { :name => 'D' }, | |
5 => { :name => 'E' }, | |
6 => { :name => 'F' } |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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 | |
# | |
# nutcracker - this script starts and stops the nutcracker-server daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Nutcracker is a proxy-server to Redis and/or Memcached | |
# processname: nutcracker-server | |
# config: /etc/nutcracker/nutcracker.conf | |
# config: /etc/sysconfig/nutcracker | |
# pidfile: /var/run/nutcracker.pid |
This file contains 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
# encoding: utf-8 | |
# Be sure to restart your server when you modify this file. | |
# Add new inflection rules using the following format | |
# (all these examples are active by default): | |
# ActiveSupport::Inflector.inflections do |inflect| | |
# inflect.plural /^(ox)$/i, '\1en' | |
# inflect.singular /^(ox)en/i, '\1' | |
# inflect.irregular 'person', 'people' | |
# inflect.uncountable %w( fish sheep ) |
This file contains 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
[core] | |
editor = vim | |
[user] | |
name = "Thiago Moretto" | |
email = "[email protected]" | |
[alias] | |
co = checkout | |
ci = commit |
This file contains 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
set nocompatible | |
syntax on | |
set ruler | |
set background=dark | |
set wildmenu " turn on wild meno :e <Tab> | |
set wildmode=list:longest,list:full | |
set completeopt=menu,longest,preview " autocomplete opts <C-p> | |
set encoding=utf-8 |
This file contains 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
import java.util.*; | |
public class StringUtil { | |
public static String encode (String[] ss) { | |
StringBuilder sb = new StringBuilder(); | |
for (String s : ss) { | |
if (sb.length() > 0) | |
sb.append(','); | |
if (s != null) | |
sb.append(s.replaceAll("\\\\", "\\\\\\\\") |
NewerOlder