Skip to content

Instantly share code, notes, and snippets.

View oliveiraev's full-sized avatar

Evandro Oliveira oliveiraev

View GitHub Profile
<?php
/**
* Calcula a participação total de cada contribuinte em uma vaquinha
* a partir de suas contribuições iniciais
*
* @param float $total O valor total da vaquinha
* @param float[] $iniciais A parcela inicial de cada contribuinte
* @return float[] A parcela final de cada contribuinte
*/
@oliveiraev
oliveiraev / get_tibia_worlds.php
Last active March 1, 2022 21:35
Get Tibia available Worlds
<?php
$curl = curl_init('https://www.tibia.com/community/?subtopic=killstatistics');
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => 'utf-8',
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36',

Keybase proof

I hereby claim:

  • I am oliveiraev on github.
  • I am oliveiraev (https://keybase.io/oliveiraev) on keybase.
  • I have a public key ASC7gWebPQaXflpt5quGwBmSH_cloq_ice6D7P4TwNFxhgo

To claim this, I am signing this object:

#!/usr/bin/env /bin/bash
set -e
function writeHeader () {
python3 - ${1} <<EOF
# -*- coding: utf-8 -*-
import sys
import os
@oliveiraev
oliveiraev / convert.py
Created September 15, 2017 23:35
Imprimidor de numeral ordinal.
# -*- coding: utf-8 -*-
u"""Imprimidor de numeral ordinal."""
import sys
UNITS = [
'',
'primeiro',
" Utiliza a área de transferência do sistema
set clipboard=unnamed,unnamedplus
" Navegação por teclas direcionais
noremap <UP> k
noremap <C-UP> (
noremap <RIGHT> l
noremap <C-RIGHT> E
noremap <DOWN> j
noremap <C-DOWN> )
# -*- coding: utf-8 -*-
"""
Adiciona períodos a datas
"""
import datetime
DAY = "1"
WEEK = "7"
MONTH = "30"
@oliveiraev
oliveiraev / pretty_json
Created November 26, 2014 15:59
Given an input (filename or stdin), prints out it space-indented
#!/usr/bin/env node
/**
* @name JSON Prettifier
* @summary Given an input (filename or stdin), prints out it space-indented
* @license [LGPLv3]{@link https://www.gnu.org/licenses/lgpl-3.0.txt}
* @version 0.0.1a
*
*/
(function () {
"use strict";
@oliveiraev
oliveiraev / Jasmine-to-Casper.js
Last active December 26, 2015 05:49
Convert Jasmine suite into parseable CasperJS test suite.
/**
* Convert Jasmine suite into parseable CasperJS test suite.
*/
casper.parseJasmineTests = (function (casper) {
"use strict";
/**
* Build a structure from Jasmine test results.
*
* Each spec generates an object with two keys: specs and tests.
@oliveiraev
oliveiraev / linux-to-vagrant.sh
Last active December 25, 2015 19:19
Set up any debian/redhat-based distro ready for vagrant.
test "$(command -v su)" || (echo "su is required but not found" && exit 1)
RUN="su"
test "$(command -v sudo)" && RUN="sudo su"
$RUN -c'
INSTALLER="apt-get"
test "$(command -v yum)" && INSTALLER="yum"
$INSTALLER install -y openssh-server
printf "\n#Vagrant additions\n" >> /etc/sudoers
useradd -s$SHELL vagrant
sed -ri "s/^vagrant:[^:]/vagrant:\!/" /etc/shadow