Skip to content

Instantly share code, notes, and snippets.

View pojda's full-sized avatar

Thiago Pojda pojda

View GitHub Profile
@pojda
pojda / example_image_utils.py
Last active April 25, 2024 15:53 — forked from josephkern/example_image_utils.py
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@pojda
pojda / pi-capture-single.py
Created March 18, 2020 14:50
Code for capturing time lapse images with a raspberry pi. It only saves one file at a time, so it should be scheduled in cron.
from time import sleep
from datetime import datetime
import picamera
now = datetime.now()
filename = now.strftime('%Y-%m-%d_%H-%M-%S-%f')
# Camera settings depending of daylight
sunrise = range(6,7,1)
@pojda
pojda / hosts
Last active November 18, 2019 12:33
Hosts (/etc/hosts) file to block email tracking tools. Append it to /etc/hosts and have fun.
127.0.0.1 t.yesware.com
@pojda
pojda / Download GSC Crawl Data Bookmarklet
Last active August 20, 2020 14:41
Based on https://www.domwoodman.com/posts/search-console-crawl-data-bookmarklet/, it just adds the GSC property name to the downloaded file name.
javascript:(function(){const crawlGraphs %3D document.querySelectorAll%28".hostload-activity script"%29%3B%0A%0Aconst isSafari %3D %28%29 %3D>%0A%09%2F%5E%28%28%3F%21chrome%7Candroid%29.%29%2Asafari%2Fi.test%28navigator.userAgent%29%3B%0A%0Aconst toCSV %3D %28data%2C headers%2C separator%2C enclosingCharacter%29 %3D> %7B%0A%09return jsons2csv%28data%2C headers%2C separator%2C enclosingCharacter%29%3B%0A%7D%3B%0A%0Aconst isJsons %3D array %3D>%0A%09Array.isArray%28array%29 %26%26%0A%09array.every%28row %3D> typeof row %3D%3D%3D "object" %26%26 %21%28row instanceof Array%29%29%3B%0A%0Aconst jsons2arrays %3D %28jsons%2C headers%29 %3D> %7B%0A%09headers %3D headers %7C%7C jsonsHeaders%28jsons%29%3B%0A%0A%09%2F%2F allow headers to have custom labels%2C defaulting to having the header data key be the label%0A%09let headerLabels %3D headers%3B%0A%09let headerKeys %3D headers%3B%0A%09if %28isJsons%28headers%29%29 %7B%0A%09%09headerLabels %3D headers.map%28header %3D> header.label%29%3B%0A%09%09headerKeys %3D headers.
@pojda
pojda / install-redis.sh
Last active August 22, 2016 19:00 — forked from FUT/install-redis.sh
Install Redis on EC2
1. Install Linux updates, set time zones, followed by GCC and Make
sudo yum -y update
sudo ln -sf /usr/share/zoneinfo/America/Sao_Paulo \
/etc/localtime
sudo yum -y install gcc make
2. Download, Untar and Make Redis 2.8 (check here http://redis.io/download)