Skip to content

Instantly share code, notes, and snippets.

View acompa's full-sized avatar

Alejandro Companioni acompa

View GitHub Profile
package ccvalidation
import (
"fmt"
"strings"
)
type Card interface {
Validate(string ccNumber) bool
}
@acompa
acompa / keybase.md
Created January 5, 2015 19:09
keybase

Keybase proof

I hereby claim:

  • I am acompa on github.
  • I am achompas (https://keybase.io/achompas) on keybase.
  • I have a public key whose fingerprint is CAD7 DD28 ABAA 364F 5F29 FAFB FF9F 25A7 5F9F EF7A

To claim this, I am signing this object:

@acompa
acompa / rpy2_setup.sh
Created September 11, 2012 18:50
Installing rpy2
#!/bin/bash
# $1 == version of R to install
#####
# Install R
#####
wget http://cran.r-project.org/src/base/R-2/R-$1.tar.gz
tar zxvf R-$1.tar.gz
cd R-$1/
private ReplacementAlgorithm selectReplacementAlgorithm(String choice) {
if (choice.matches("N")) {
return new NRUAlgorithm();
} else if (choice.matches("l")) {
return new LRUAlgorithm();
} else if (choice.matches("r")) {
return new RandomAlgorithm();
} else if (choice.matches("f")) {
return new FIFOAlgorithm();
@acompa
acompa / transmit.py
Created July 24, 2012 20:28
Graphite tester
#!/usr/bin/python
""" Script for submitting data to Graphite. """
import socket
import time
import sys
import random
import string
@acompa
acompa / scrapegist.py
Created February 6, 2011 04:08
General idea behind opening and DLing BBs.
import urllib2, re
targetURL = "http://www.minneapolisfed.org/bb/reports/1990/90-01-su.cfm"
site = urllib2.urlopen(targetURL)
out = "/Users/alexc/Dropbox/Develop/BB/data/1990-01.html"
with open(out, 'w') as BBFile:
for line in site.readlines():
p = re.compile(r'<.*?>')
BBFile.write(p.sub('', line))