Skip to content

Instantly share code, notes, and snippets.

View fred's full-sized avatar

Frederico Araujo fred

  • Thailand
View GitHub Profile
fred /
Created May 14, 2018 05:46 — forked from michaelkeevildown/
Credit Card Regex Patterns

Credit Card Regex

  • Amex Card: ^3[47][0-9]{13}$
  • BCGlobal: ^(6541|6556)[0-9]{12}$
  • Carte Blanche Card: ^389[0-9]{11}$
  • Diners Club Card: ^3(?:0[0-5]|[68][0-9])[0-9]{11}$
  • Discover Card: ^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$
  • Insta Payment Card: ^63[7-9][0-9]{13}$
  • JCB Card: ^(?:2131|1800|35\d{3})\d{11}$
  • KoreanLocalCard: ^9[0-9]{15}$
fred /
Created July 9, 2016 10:12

Keybase proof

I hereby claim:

  • I am fred on github.
  • I am frederico ( on keybase.
  • I have a public key ASCKg-KYS58Ub3P-nBUGn9Sg-6JWPFqWxOegmzG8ed_FeAo

To claim this, I am signing this object:

fred / sqs_cloudtrail_elasticsearch.rb
Last active August 31, 2017 13:27
Script to get SQS messages, download S3 file of cloudtrail and index in Elasticsearch using bulk mode
# Ruby Script to Get messages from SQS containing information of Cloudtrail json.gz file in S3
# everytime a cloudtrail event occurs, AWS will upload the log in json.gz format to S3 and notify in SQS
# we use SQS to get new log events and download from S3, combine all in one json file for bulk importing to Elasticserach
# ready to be used with Kibana
# Run this houly or every 30 minutes.
require 'aws-sdk'
require 'json'
fred / reindex_cloudtrail.rb
Created August 26, 2015 08:29
Reindex Cloudtrail logs in ElasticSearch, for Kibana usage
require 'aws-sdk'
require 'json'
require 'uri'
# Your current cloudtrail S3 preffix
AWS_SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxx'
fred / omise_export.rb
Last active August 29, 2015 14:21
Full Transactions in CSV format
#!/usr/bin/env ruby
# how to run:
# ruby ./omise_export.rb
# Works on Mac OS X
# It will generate (and overwrite) a csv file with name full_transactions.csv
require 'date'
require 'json'
# Update your valid Live Secret Key, this is only a test key:
fred / omise_export.rb
Last active August 29, 2015 14:20
exporting charges and refunds to a CSV format files (charges.csv, refunds.csv)
#!/usr/bin/env ruby
# how to run:
# ruby ./omise_export.rb
require 'date'
require 'json'
# CHANGE the next 4 variables
# just be aware of timezone overlapping between months, Omise will parse dates as UTC time
skey = 'your secret key'
fred /
Created March 24, 2015 07:16
My ~/.config/fish/
# ~/.config/fish/
# for mate and subl
set PATH $HOME/bin $PATH
set PATH /usr/local/bin /usr/local/sbin $PATH
set PATH $HOME/.rbenv/bin $PATH
set PATH $HOME/.rbenv/shims $PATH
rbenv rehash >/dev/null ^&1
if [[ ! `which bundle` ]]; then
local cur prev commands
commands="help install update package exec config check list show outdated console open viz init gem platform"