Skip to content

Instantly share code, notes, and snippets.

View MateusZitelli's full-sized avatar
👨‍💻
hacking

Mateus Zitelli MateusZitelli

👨‍💻
hacking
  • QA Wolf
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mateuszitelli on github.
  • I am mzitll (https://keybase.io/mzitll) on keybase.
  • I have a public key ASBnWF5dDne7N2ZTLCeXNCR1yZk2P58Q-0o_9woIvMUlnAo

To claim this, I am signing this object:

import face_recognition
import csv
from PIL import Image, ImageDraw
import urllib.request
import csv
import os.path
import pickle
import numpy as np
# Create arrays of known face encodings and their names

Teddy Roosevelt's presidential campaign negociation:

3 million copies of a photo were printed before asking the right for the photographer, how to negotiate with the photographer a deal?

1. Define your BATNA "Best Alternative to a Negotiated Agreement".

The BATNA would be Roosevelt capaing administration printing the photos again, lets say, for $500,000

2. Define your minimum condition for agreement.

@MateusZitelli
MateusZitelli / genetic_algorithm.py
Created December 10, 2017 05:16
Typesafe Genetic Algorithm in Python
from typing import Tuple, Iterable, Callable, TypeVar
import functools
Solution = TypeVar("Solution")
Population = Iterable[Solution]
EvaluatedPopulation = Iterable[Tuple[float, Solution]]
EvolutionState = Tuple[EvaluatedPopulation, bool]
FitnessFunction = Callable[[Solution], float]
Mutator = Callable[[Solution], Solution]
@MateusZitelli
MateusZitelli / badly_interleaved.md
Last active December 3, 2017 16:17
OOM error with ExoPlayer and badly interleaved videos.

OOM error with ExoPlayer and badly interleaved videos.

The problem

Since adopting ExoPlayer in Collect our users started to face crashes in different points of the app. Analysing the crashes we initial and wrongly concluded that was a problem with Samsung phones, however further investigation showed the problem was with Samsung Gear 360 camera videos.

To understand what happened first we need to understand a little about MP4 files. MPEG-4 Part 14 aka MP4 is a multimedia container format that allows the storage of video, audio, subtitles and also images. The different media are stored in different tracks, those tracks are divided in small samples. Those samples are organized in a way where corresponding pieces of different

@MateusZitelli
MateusZitelli / 3dm-to-sat.py
Created August 16, 2017 14:08
3D matching reduction to SAT
def match_to_sat(xyz, T):
coverage = [[[] for _ in range(xyz[i])] for i in range(3)]
for i, t in enumerate(T):
for j, v in enumerate(t):
coverage[j][v].append(i)
instance = set()
for c in coverage:
for x in c:
# if there is points not covered by any set, add a always false statement.
[(0.840000, SimpleClassificationPipeline({'rescaling:__choice__': 'standardize', 'preprocessor:polynomial:degree': 2, 'classifier:adaboost:learning_rate': 0.3740823239105414, 'one_hot_encoding:minimum_fraction': 0.002144117618160979, 'classifier:adaboost:n_estimators': 457, 'preprocessor:__choice__': 'polynomial', 'preprocessor:polynomial:include_bias': 'True', 'one_hot_encoding:use_minimum_fraction': 'True', 'balancing:strategy': 'none', 'preprocessor:polynomial:interaction_only': 'False', 'imputation:strategy': 'most_frequent', 'classifier:__choice__': 'adaboost', 'classifier:adaboost:max_depth': 10, 'classifier:adaboost:algorithm': 'SAMME'},
dataset_properties={
'target_type': 'classification',
'multilabel': False,
'multiclass': True,
'sparse': False,
'task': 2,
'signed': False})),
(0.060000, SimpleClassificationPipeline({'rescaling:__choice__': 'standardize', 'classifier:random_forest:max_leaf_nodes': 'None', 'classifier:random_forest:bootstrap': 'False', 'classifier:random_forest:criterion':
[(0.960000, MyDummyClassifier(configuration=1, init_params=None, random_state=None)),
(0.020000, SimpleClassificationPipeline({'one_hot_encoding:minimum_fraction': 0.01, 'imputation:strategy': 'mean', 'classifier:random_forest:max_leaf_nodes': 'None', 'classifier:random_forest:max_depth': 'None', 'classifier:random_forest:n_estimators': 100, 'classifier:random_forest:min_samples_leaf': 1, 'classifier:random_forest:criterion': 'gini', 'rescaling:__choice__': 'standardize', 'classifier:random_forest:min_samples_split': 2, 'one_hot_encoding:use_minimum_fraction': 'True', 'balancing:strategy': 'none', 'classifier:random_forest:min_weight_fraction_leaf': 0.0, 'preprocessor:__choice__': 'no_preprocessing', 'classifier:random_forest:bootstrap': 'True', 'classifier:random_forest:max_features': 1.0, 'classifier:__choice__': 'random_forest'},
dataset_properties={
'multilabel': False,
'task': 2,
'signed': False,
'sparse': False,
'multiclass': True,
'target_type': 'classification'})),
(0.020000, SimpleClassif
import autosklearn.classification
import sklearn.model_selection
import sklearn.datasets
import sklearn.metrics
import numpy as np
classes = {
"CYT": 0,
"NUC": 1,
"MIT": 2,
@MateusZitelli
MateusZitelli / forever-init.d
Last active August 29, 2015 14:20 — forked from toniher/forever-init.d
Init.d script for Node.js/IO.js servers, with forever and nvm.
#!/bin/bash
### BEGIN INIT INFO
# Provides: YOUR NAME HERE
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop the forever nodejs application. Requires sudo
### END INIT INFO