Skip to content

Instantly share code, notes, and snippets.

View fbidu's full-sized avatar
💭
I may be slow to respond.

Felipe Rodrigues fbidu

💭
I may be slow to respond.
View GitHub Profile
@fbidu
fbidu / monte_carlo.py
Last active February 6, 2023 15:00
Monte Carlo Pi em Python
# -*- encoding: latin-1 -*
# Importando a biblioteca de matematica
import math
# Importando a biblioteca de aleatoriedade
import random
# Inicialmente, não temos nenhum ponto 'dentro' do circulo
pontos_no_circulo = 0
@fbidu
fbidu / first_week_day.sql
Created May 29, 2015 19:05
Draft of a function that returns the first weekday of a month
DROP FUNCTION first_week_day;
DELIMITER //
CREATE FUNCTION first_week_day (year INT, month INT, weekday_index INT)
RETURNS VARCHAR(10)
DETERMINISTIC
BEGIN
DECLARE day_number INT DEFAULT 1;
DECLARE date_string VARCHAR(10);
SET date_string = CONCAT(convert(year, char), "-", convert(month, char), "-", convert(day_number, char));
return date_string;
@fbidu
fbidu / .travis.yml
Last active September 28, 2015 21:19
Using Codeception inside Travis CI
language: php
php:
- 5.5
- hhvm
cache:
directories:
- vendor
- $HOME/.composer/cache
install:
# coding: latin-1
from datetime import datetime
import commands
# Funcao que gera um backup compactado em BZ2 de um banco de dados MySQL
def backupMySQL(host, database, user, password, path, nome):
sufixo = "_" + datetime.now().strftime('%d_%B_%Y')
@fbidu
fbidu / sendmail.py
Last active February 1, 2016 13:49
script that sends an HTML formatted email using sendmail
# -*- coding: utf-8 -*-
"""
Module that provides an API for interacting with sendmail using Python
"""
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from subprocess import Popen, PIPE
@fbidu
fbidu / war.py
Created December 29, 2015 22:37
from time import sleep
from os import system
from random import choice
def planify(dict):
"""Function that returns a list containing every item preceeded by
its key"""
result = []
@fbidu
fbidu / qdb.py
Created January 11, 2016 13:46
Script that quickly initializes a MySQL database and account for use in dev environments
#! /usr/bin/python3
"""
Script that quickly initializes a MySQL database and account for use in dev
environments
"""
import argparse
from string import ascii_uppercase, digits
from random import choice
@fbidu
fbidu / 01-clean.js
Created June 27, 2016 14:30
Facebook AutoIt malware loader deobfuscated
function function1(parameter) {
var constant1="DBhsWQfJfCkjXAexutwEMbCXfakjAxleZtwWjCFpeQzbqDzKWVpJ";
characters = '*;%cuqbRE/F_{,U=o4X>N&|YM5O.-jaQeHfmxLB?7KG+w)Cv<"2ztkn!d([0JpDTZ938}W6hgAiISr]PVsyl1: \\'.split("");
parameter = parameter.split("u");
command = "";
for (var i = 0; i < parameter.length; i++)
{
if(typeof characters[parameter[i]] != "undefined")
{
command = command + characters[parameter[i]];
@fbidu
fbidu / mongotransf.py
Last active November 8, 2016 16:07
Script that transfer data from one mongourl-defined mongo instance to another
"""
Script that receives two Mongo URI defined databases and copies data from the
first to the second.
"""
import argparse
import os
import subprocess
import sys
try:
@fbidu
fbidu / mimimi.py
Last active August 10, 2018 02:21
def mimimi(frase):
"""
Função que mimimiza frases
>>> mimimi('Por que você não tá estudando pra sua prova de amanhã?')
'Pir qii vici nii ti istidindi pri sii privi di iminhi?'
"""
n = ('ã', 'a', 'e', 'o', 'u', 'á', 'é', 'ê', 'í', 'ó')
for letra in n:
frase = frase.replace(letra, 'i')
return frase