Skip to content

Instantly share code, notes, and snippets.

@rafaelcaricio
rafaelcaricio / api.py
Created April 25, 2016 12:34
Custom type format - Connexion
import logging
import re
from connexion import App
from jsonschema import draft4_format_checker
MONEY_RE = re.compile('^\$\s*\d+(\.\d\d)?')
logging.basicConfig(level=logging.DEBUG)
(defn fizzbuzz [max_value]
(fizzbuzz_acc max_value 1))
(defn fizzbuzz_acc [max_value acc]
(if (<= acc max_value)
(do (if (is_fizzbuzz acc)
(println "fizzbuzz")
(if (is_fizz acc)
(println "fizz")
(if (is_buzz acc)
-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v2.0.1
Comment: https://keybase.io/crypto
wcFMA/L5rq4WVDHqAQ/7B1q6ynmpFPIpca/CiWQqtwbfQwht8TwkyUPYtdq1r6XZ
12dBkcaDW0TmBCPeJcDeiyLra+bdYR613VrnqKkR0QtU/7TTkqntq6lXMOuBILzY
cdAMU1Q4mFOsCCs/J9ivDV/QWUcYrCXSRTE3HQw20n66uSFFBzzXAh4gmu73gFb/
psjSqyzyKjEzfcu1AByue4bQmi5j2mlApCcQ5OZ73ddoUF66d2EcMjFwLt/9yEiA
HSMaOwsxf8ezuvj0vNrrHCp5yZ//Oi6AYdbjCBzvbhQg76O0ZKvgPn9gm2+x0xfP
P/1/HruYZ/crje9STkial+8PTnskOv5IxHLGIuSRcHiMAEohcoIxtifaLTTXQIhB
### Keybase proof
I hereby claim:
* I am rafaelcaricio on github.
* I am rafaelcaricio (https://keybase.io/rafaelcaricio) on keybase.
* I have a public key whose fingerprint is 08D9 4BF8 357C 744E 8964 FBB0 75AE 057C EE9E DF0C
To claim this, I am signing this object:
@rafaelcaricio
rafaelcaricio / all_emails.txt
Created January 7, 2015 21:26
Readable version of emails communication with Alchemia staff
Dear Alchemia staff,
It's with profound disappointment I am writing you this e-mail to describe a racist situation towards my friends and I coming from your security guards on the night of Saturday 04/01/2015 to Sunday 05/01/2015.
I am a foreigner which regularly visits Krakow as I am always in love with this city and its people. Having coming here for so many years, I ended up making many local friends and one of our favourite spots is Alchemia in Plac Nowy.
Unfortunately yesterday an event left me shocked and very sad. Whilst having a good time with my friends, having a chat and laughs, two of your hired security staff, sitting on a table in the corner, began to shout racist comments and gestures against our table. It was not a joke - the prejudice was towards us, a group of foreigners and locals, and it was deliberate. We could hear sounds and gestures that imitated a monkey as well as sayings like "kurwa malpa", which according to our local friends, meant "fucking monkeys".
As an esteemed customer
@rafaelcaricio
rafaelcaricio / fizzbuzz.erl
Created December 23, 2014 13:31
FizzBuzz in Erlang
-module(fizzbuzz).
-export([up_to/1]).
for(Number) when Number rem 3 == 0 andalso Number rem 5 == 0 ->
'FizzBuzz';
for(Number) when Number rem 3 == 0 ->
'Fizz';
for(Number) when Number rem 5 == 0 ->
'Buzz';
@rafaelcaricio
rafaelcaricio / show_geolocation.py
Created November 26, 2014 11:40
Shows geolocation stored in EXIF of image
#!/usr/bin/env python
import argparse
try:
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
except ImportError:
print "You need to install PIL. Please check: http://www.pythonware.com/products/pil/"
def decode_gps_info(exif):
@rafaelcaricio
rafaelcaricio / howto.md
Last active December 4, 2019 15:17
Using git bisect

Using git bisect

Git provides a simple way to find out where some code was modified or removed from your codebase. You can use git bisect for that and the processes can be completely automated.

As example I will try to find out when the method send_email_notification was removed from the file app/models/person.rb. So you have to create a automated bash file, or other kind of script, that should return 0 when the method is found and 1 otherwise. So git can run this script for each commit until it returns 1, which means that the method was removed in that commit. There's the script we gonna use:

if [[ `cat app/models/person.rb | grep send_email_notification` ]]; then
@rafaelcaricio
rafaelcaricio / gist:f1cca605ab669d66af5a
Created October 31, 2014 21:26
an0jirV8aB9mE8Oj2Nav5kuD7vauC9.txt
Verifying that +rafaelcaricio is my Bitcoin username. You can send me #bitcoin here: https://onename.io/rafaelcaricio
@rafaelcaricio
rafaelcaricio / find_file_s3.py
Created December 4, 2013 15:57
find file in s3
#!/usr/bin/env python
import os
import argparse
from boto.s3.connection import S3Connection
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Find filename on s3')
parser.add_argument('resource_name', metavar='resource_name', help='Part of the resource name.')