This file contains hidden or 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
package com.gabrielbauman.gist; | |
import java.util.regex.Pattern; | |
public enum CardType { | |
UNKNOWN, | |
VISA("^4[0-9]{12}(?:[0-9]{3})?$"), | |
MASTERCARD("^5[1-5][0-9]{14}$"), | |
AMERICAN_EXPRESS("^3[47][0-9]{13}$"), |
This file contains hidden or 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
# Installing graphite dependencies | |
apt-get install -y python2.6 python-pip python-cairo python-django python-django-tagging | |
apt-get install -y libapache2-mod-wsgi python-twisted python-memcache python-pysqlite2 python-simplejson | |
pip install whisper | |
pip install carbon | |
pip install graphite-web | |
# Setup a vhost by grabbing the example the graphite team released on their repo. | |
# In this file, you'll provide the url used to access to your Graphite dashboard | |
wget https://raw.github.com/tmm1/graphite/master/examples/example-graphite-vhost.conf -O /etc/apache2/sites-available/graphite |
This file contains hidden or 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
-module(pvsl). | |
-define(LIST_SIZES, [10000, 100000, 1000000]). | |
-define(RETRIES, 1000). | |
-compile(export_all). | |
start() -> | |
% test for different list sizes | |
lists:foreach(fun(N) -> test_list(N) end, ?LIST_SIZES). | |
test_list(ListSize) -> |
This file contains hidden or 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
%Copy and paste the below Anonymous functions to Erlang Shell | |
Get_table_structure = fun(TableName) -> | |
{tables,[{TableName,[{record_name,mnesia:table_info(TableName,record_name)},{attributes,mnesia:table_info(TableName,attributes)}]}]} | |
end. | |
Read_tablerows = fun(Rows,TableName,IODevice,Key) -> | |
lists:foldl(fun(_,Acc) -> | |
NextKey = mnesia:dirty_next(TableName,Acc), | |
[Record] = mnesia:dirty_read(TableName,Acc), | |
io:format(IODevice,"~p.~n",[Record]), |
This file contains hidden or 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 'fileutils' | |
start_time = Time.now | |
SOURCE_DB = { | |
:name => 'db_name', | |
:user => 'db_user', | |
:password => 'db_pass', | |
:host => 'localhost' |