Skip to content

Instantly share code, notes, and snippets.

import base64
import cv2
from PIL import Image
cap = cv2.VideoCapture(0)
_, img = cap.read()
image_string = cv2.imencode(".png", img)[1].tostring()
output = io.BytesIO()
Image.fromarray(img).save(output, format='PNG')
docker images | awk '/<none/{print $3}' | xargs docker rmi
docker ps -f "status=exited" -q | xargs docker rm
curl -fsSL https://gist.githubusercontent.com/satomacoto/b27dc3f871938d2614819bba3c589b45/raw/setup1.sh | bash
curl -fsSL https://gist.githubusercontent.com/satomacoto/b27dc3f871938d2614819bba3c589b45/raw/setup2.sh | bash
pyenv install miniconda3-latest
pyenv local miniconda3-latest
conda create -n myenv anaconda
source (conda info --root)/etc/fish/conf.d/conda.fish
conda activate myenv
@satomacoto
satomacoto / Twitter API with Curl
Created September 9, 2017 01:12 — forked from apolloclark/Twitter API with Curl
Twitter API with Curl
# create an account, create an app
# @see https://apps.twitter.com/
# retrieve the access tokens
# @see https://dev.twitter.com/oauth/reference/post/oauth2/token
# create the file ~/twitter_api
nano ~/twitter_api
Authorization: OAuth oauth_consumer_key="XXXXXX", oauth_nonce="11111111", oauth_signature="XXXXXX", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1450728725", oauth_token="99999-XXXXXX", oauth_version="1.0"
@satomacoto
satomacoto / README.md
Last active August 3, 2016 02:11
ML Validation
@satomacoto
satomacoto / graph.json
Last active June 10, 2016 08:03
network
{"nodes":[{"name":"Myriel","group":1},{"name":"Napoleon","group":1},{"name":"Mlle.Baptistine","group":1},{"name":"Mme.Magloire","group":1},{"name":"CountessdeLo","group":1},{"name":"Geborand","group":1},{"name":"Champtercier","group":1},{"name":"Cravatte","group":1},{"name":"Count","group":1},{"name":"OldMan","group":1},{"name":"Labarre","group":2},{"name":"Valjean","group":2},{"name":"Marguerite","group":3},{"name":"Mme.deR","group":2},{"name":"Isabeau","group":2},{"name":"Gervais","group":2},{"name":"Tholomyes","group":3},{"name":"Listolier","group":3},{"name":"Fameuil","group":3},{"name":"Blacheville","group":3},{"name":"Favourite","group":3},{"name":"Dahlia","group":3},{"name":"Zephine","group":3},{"name":"Fantine","group":3},{"name":"Mme.Thenardier","group":4},{"name":"Thenardier","group":4},{"name":"Cosette","group":5},{"name":"Javert","group":4},{"name":"Fauchelevent","group":0},{"name":"Bamatabois","group":2},{"name":"Perpetue","group":3},{"name":"Simplice","group":2},{"name":"Scaufflaire","group":2},
# -*- coding: utf-8 -*-
from sklearn.base import BaseEstimator, RegressorMixin, TransformerMixin
from sklearn.cross_validation import cross_val_predict
class ThroughTransformer(BaseEstimator, TransformerMixin):
def fit(self, X, y=None, **fit_param):
return self
@satomacoto
satomacoto / README.md
Last active April 7, 2024 05:14
Install pyenv and conda

Install pyenv

$ brew update
$ brew install pyenv

Check available versions and install

@satomacoto
satomacoto / pinv2regressor.py
Created February 18, 2016 08:47
Pinv2Regressor
class Pinv2Regressor:
def __init__(self, estimators, cv=5):
self.estimators = estimators
self.cv = cv
def fit(self, X, y, verbose=False):
preds = {}
for k, estimator in self.estimators.items():
if verbose:
print(k, estimator)