Skip to content

Instantly share code, notes, and snippets.

@aterreno
aterreno / wavefront
Created February 4, 2011 15:23
n by n wavefront matrix
wavefront :: Int -> Array (Int,Int) Int
wavefront n = a where
a = array ((1,1),(n,n))
([((1,j), 1) | j <- [1..n]] ++
[((i,1), 1) | i <- [2..n]] ++
[((i,j), a!(i,j-1) + a!(i-1,j-1) + a!(i-1,j))
| i <- [2..n], j <- [2..n]])
@aterreno
aterreno / nginx.conf
Created April 14, 2011 10:31
upstart script for nginx
description "nginx http daemon"
start on started mongodb
stop on runlevel [016]
console owner
exec /opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf -g "daemon off;"
@aterreno
aterreno / gist:944121
Created April 27, 2011 11:51
sqoop from mysql to hbase
sudo sqoop import --connect jdbc:mysql://mysql_server/mysql_table --table mysql_table_name --hbase-table hbase_table_name --hbase-row-key mysql_column --column-family metadata --hbase-create-table --username root -P
@aterreno
aterreno / gist:944122
Created April 27, 2011 11:51
sqoop from mysql to hive
sudo sqoop import --hive-import --connect jdbc:mysql://mysql_server/mysql_table --table mysql_table --hive-table hive_table --username root --direct -P
@aterreno
aterreno / big.sh
Created May 16, 2011 08:27
list of 10 biggest files
du -a / | sort -n -r | head -n 10
@aterreno
aterreno / hadoop.Applescript
Created June 28, 2011 09:30
ssh into hadoop cluster
-- Launch iTerm and log into multiple servers using SSH
tell application "iTerm"
activate
-- Read serverlist from file path below
set Servers to paragraphs of (do shell script "/bin/cat $HOME/Serverslist")
repeat with nextLine in Servers
-- If line into file is not empty (blank line) do the rest
if length of nextLine is greater than 0 then
set server to "nextLine"
set term to (current terminal)
@aterreno
aterreno / posterous.rb
Last active December 14, 2015 01:08
Migration script from http://posterous.com/ to github pages, forked from https://github.com/AlexeyMK/alexeymk.github.com/blob/master/posterous_import.rb with a monkey patch on Posterous Connection.
require 'rubygems'
require 'jekyll'
require 'fileutils'
require 'posterous'
require 'net/http'
require 'URI'
puts ARGV, "IS ARGV"
module Posterous
require 'posterous'
require 'time'
module Posterous
module Connection
def default_options
@default_options ||= {
#:username => Posterous.config['username'],
#:password => Posterous.config['password']
:userpwd => Posterous.config['username']+":"+Posterous.config['password']
@aterreno
aterreno / .gitignore
Last active January 15, 2018 10:57
Sort of default .gitignore for clojure development with emacs, mac os, lein and random hacking with vi from time to time, why not
.DS_Store
*~
\#*\#
.\#*
*.swp
@aterreno
aterreno / .gitconfig
Last active January 25, 2021 17:00
my .gitconfig
[user]
name = Antonio Terreno
email = antonio.terreno@example.com
[alias]
aliases = !git config --get-regexp alias | sed -re 's/alias\\.(\\S*)\\s(.*)$/\\1 = \\2/g'
up = !git pull --rebase --autostash
co = checkout
br = branch
ci = commit
st = status