Skip to content

Instantly share code, notes, and snippets.

View fabito's full-sized avatar
🏠
Working from home

Fábio Franco Uechi fabito

🏠
Working from home
View GitHub Profile
@fabito
fabito / sentry.py
Created December 13, 2022 20:02 — forked from fliphess/sentry.py
Ansible sentry callback plugin - Send all errors from ansible to Sentry
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import getpass
import logging
import logging.config
import os
import socket
try:
@fabito
fabito / grpc-locust.py
Created September 8, 2020 03:42 — forked from skyrocknroll/grpc-locust.py
grpc locust
from locust.stats import RequestStats
from locust import Locust, TaskSet, task, events
import os
import sys, getopt, argparse
from random import randint,random
import json
from locust.events import EventHook
import requests
import re
import grpc
@fabito
fabito / dumb-ap-wired-link.sh
Created October 18, 2018 13:09 — forked from braian87b/dumb-ap-wired-link.sh
How to setup a Dumb AP, Wired backbone for OpenWRT / LEDE
#!/usr/bin/env bash
# Bash3 Boilerplate. Copyright (c) 2014, kvz.io
set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace
# Set magic variables for current file & dir
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
#!/usr/bin/env python
'''Crop an image to just the portions containing text.
Usage:
./crop_morphology.py path/to/image.jpg
This will place the cropped image in path/to/image.crop.png.
For details on the methodology, see
[
{
"name": "project_id",
"type": "string",
"mode": "required"
},
{
"name": "id",
"type": "string",
"mode": "required"
@fabito
fabito / get_lat_lon_exif_pil.py
Created February 7, 2017 15:29 — forked from erans/get_lat_lon_exif_pil.py
Get Latitude and Longitude from EXIF using PIL
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags"""
exif_data = {}
info = image._getexif()
if info:
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
@fabito
fabito / gist:e0c1ab1d9d8ff8d1b5561884acd126ee
Created August 15, 2016 17:13 — forked from robinloxley1/gist:7ea7c4f37a3413b1ca16
sample elasticsearch query to sort parent based on child field
{
"query":{
"has_child":{
"query":{
"function_score":{
"functions":[
{
"field_value_factor":{
"factor":1,
"field":"count"
#!/usr/bin/python
import flac.encoder as encoder
import pyaudio
import sys
import requests
import random
from threading import Thread
from Queue import Queue, Empty