Skip to content

Instantly share code, notes, and snippets.

View mfilipelino's full-sized avatar
:octocat:

Marcos Lino mfilipelino

:octocat:
  • SSense
  • Montreal - Canada
  • 15:18 (UTC -12:00)
View GitHub Profile
@mfilipelino
mfilipelino / vector.c
Last active May 20, 2016 01:48
vector int
/*
TODO:
function:
[] vector_erase
error:
[] implements error
*/
#define SPEED 75
#define INPUT_BLACKCOLOR 1
#define INPUT_BLUECOLOR 2
#define INPUT_GREENCOLOR 3
#define INPUT_YELLOWCOLOR 4
#define INPUT_REDCOLOR 5
#define INPUT_WHITECOLOR 6
//************ ÚLTIMO CÓDIGO *****************
@mfilipelino
mfilipelino / bfs.py
Last active July 5, 2019 18:43
Bfs algorithm
import Queue
Grafo = { 0 : [1, 3],
1 : [0, 2],
2 : [1, 3],
3 : [0, 2]
}
def queue_insert(q, v):
#define THRESHOLD 40
struct ColorState {
int colorval;
unsigned int raw[];
unsigned int norm[];
int scaled[];
};
string debug_std_colors[] = {
@mfilipelino
mfilipelino / todascombinacoes.py
Last active November 10, 2015 13:05
Todas as combinações de um conjunto #backtrack #combinatory
def imprime(letras, vet, lst):
s = ''
for x in xrange(len(letras)):
if vet[x] == True:
s += letras[x]
lst.append(s)
def combinacoes(letras, vet, p, n, lst):
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <stdint.h> // portable: uint64_t MSVC: __int64
// MSVC defines this in winsock2.h!?
typedef struct timeval {
long tv_sec;
long tv_usec;
} timeval;
@mfilipelino
mfilipelino / ContainerThreadPool.java
Created August 19, 2015 00:12
#java #thread #concurrent #pool #threadpool #Executors #ExecutorService
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ContainerThreadPool {
private static ContainerThreadPool contairnerThreadPoll;
public static ContainerThreadPool getInstance() {
@mfilipelino
mfilipelino / re_util.py
Last active October 7, 2015 17:57
#python #re #util
"""
Digit: d
Word: w
"""
VERSION = r'\d{2}(\.\d{2}){3}([-\.]\w+)?' # 'dd.dd.dd.dd' or 'dd.dd.dd.dd-d' or dd.dd.dd.dd-w'
CPF = r'\d{3}\.\d{3}\.\d{3}-\d{2}' # 'ddd.ddd.ddd-dd'
TELEFONE = r'\d{3} \d{4}-\d{4}' # 'dd dddd-dddd
HORA = r'[012]\d(:[0-5]\d){2}' # 'd[0-2]d:d[0-5]d:dd'
FILE_LOG = r'^\w+\.log$' # file.log
@mfilipelino
mfilipelino / CurrentDateTime.cpp
Last active October 30, 2015 14:10
tag: datetime
std::string currentDateTime()
{
time_t now = time(0);
struct tm tstruct;
char buf[80];
tstruct = *localtime(&now);
strftime(buf, sizeof(buf), "%Y-%m-%d.%X", &tstruct);
std::string str(buf);
return str;
/*1 - Definir um predicado que faça a inserção de um elemento na primeira posição de uma lista */
inserePrimeira(X,L,[X|L]).
/*2 - Definir um predicado que faça a inserção de um elemento na posição N da lista*/
insereN(X,1,L,[X|L]).
insereN(X,N,[C|L],[C|R]):-N1 is N-1, insereN(X,N1,L,R).
/* Lado direito é sempre estático (resposta) */