This file contains 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
#!/bin/usr/bash | |
BEGIN=$(date -u +%s); | |
for i in `seq 1 $2`; do | |
$(wget -H -p --cache=off --delete-after $1 &> /dev/null) | |
done | |
END=$(date -u +%s); |
This file contains 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
def generate_cpf(self): | |
cpf = [random.randint(0, 9) for x in range(9)] | |
for _ in range(2): | |
val = sum([(len(cpf) + 1 - i) * v for i, v in enumerate(cpf)]) % 11 | |
cpf.append(11 - val if val > 1 else 0) | |
return '%s%s%s.%s%s%s.%s%s%s-%s%s' % tuple(cpf) |
This file contains 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
defmodule MergeSort do | |
def sort([]), do: [] | |
def sort([h | []]), do: [h] | |
def sort(l) do | |
{l1, l2} = Enum.split(l, div(length(l), 2)) | |
merge(l1, l2) | |
end | |
def merge([h1 | []], [h2 | []]) do | |
if h1 > h2 do | |
:lists.merge([h2], [h1]) |
This file contains 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
#! /usr/bin/python | |
from random import randrange | |
def generate_12_random_numbers(): | |
numbers = [] | |
for x in range(12): | |
numbers.append(randrange(10)) | |
return numbers | |
def calculate_checksum(ean): |