Skip to content

Instantly share code, notes, and snippets.

View konr's full-sized avatar

Konrad Scorciapino konr

  • São Paulo, Brazil
View GitHub Profile
### Keybase proof
I hereby claim:
* I am konr on github.
* I am konr108 (https://keybase.io/konr108) on keybase.
* I have a public key ASCbkYD_OxuZ7OCeOigs6fPMGvmzOmxr_JcrH6ZA1sORago
To claim this, I am signing this object:
@konr
konr / keybase.md
Created March 11, 2014 14:09
keybase.md

Keybase proof

I hereby claim:

  • I am konr on github.
  • I am konr (https://keybase.io/konr) on keybase.
  • I have a public key whose fingerprint is 0257 552D 70ED 787A FDC7 6B33 9F66 B6F7 2C0E 5400

To claim this, I am signing this object:

@konr
konr / gist:8611923
Created January 25, 2014 04:33
doge-dice.com simulator
(ns doge-dice-calculator)
(def house-edge 0.01)
(defn dice []
(rand))
(defn roll-low [chance]
(< (dice) chance))
@konr
konr / flv2mp3.sh
Created January 11, 2014 02:59
.flv to .mp3 using mplayer
#!/bin/sh
for flv in $(find . -name '*flv'); do
mplayer -dumpaudio $flv -dumpfile ${flv/flv/mp3}
done
@konr
konr / gist:7563516
Created November 20, 2013 13:53
skeletons example
(def skeleton
{:fullname {:required true
:as [:account-request :name]
:eg "Konrad Scorciapino"}
:email {:required true
:as [:account-request :email]
:eg "konrad@eo2.com.br"
:validator v/validate-email}
:id {:as [:meta :id]
:eg "06965086-c44b-4395-a435-dc7c20a10757"
@konr
konr / gist:6556400
Created September 13, 2013 21:37
Pull all repos from a dir
#!/bin/sh
repos=/opt/repos/
old_dir=$PWD
for dir in $(find $repos -maxdepth 1 -mindepth 1 -type d); do
cd $dir
echo '###########' $(pwd) '###########'
git pull --ff-only
done
@konr
konr / cpf-validator.clj
Created July 23, 2013 14:44
CPF validator in Clojure
(ns backend.utils
(:require
[swiss-arrows.core :refer :all]))
(defn check-cpf [cpf]
(let [digits (->> cpf (re-seq #"\d") (map #(Integer. %)))
blacklisted? (partial re-find #"^12345678909|(\d)\1{10}$")
formatted? (partial re-find #"^\d{11}$")
checksum-ok? (fn [digit digits]
(-<> (for [i (range digit)] (* (nth digits i) (+ digit 1 (- i))))