Skip to content

Instantly share code, notes, and snippets.

View berinhard's full-sized avatar
👾
let's play that

berin berinhard

👾
let's play that
View GitHub Profile
@berinhard
berinhard / setup-foxdot-processing.md
Last active November 9, 2023 09:34
Setup de Algorave com Pythonn
@berinhard
berinhard / restaurantes_sp.md
Last active March 14, 2022 20:40
Meus Restaurantes <3 de SP

DISCLAIMER

Essa lista é completamente pessoal e todas as indicações, em geral, ficam em bairros próximos aos bairros que eu morei em São Paulo. E sim, com cercerteza devem haver outros restaurantes que você moradora de São Paulo acha que faltou na lista. Mas haja dinheiro pra ser crítico gastrônimico em São Paulo, né querida?

LAMEN

Porque sim

@berinhard
berinhard / json_to_srt.py
Last active November 12, 2021 15:06
Gist do convert Amazon's transcribe JSON to SRT format
"""
$ python json_to_srt.py <json_filepath> <output_srt>
Reference: https://aws.amazon.com/blogs/machine-learning/create-video-subtitles-with-translation-using-machine-learning/
"""
import sys
import json
def getPhrasesFromTranscript( ts ):
@berinhard
berinhard / ipdb_breakpoint.vim
Created August 13, 2010 19:30
A script to enable easy ipdb usage for Vim users.
" Author: Bernardo Fontes <falecomigo@bernardofontes.net>
" Website: http://www.bernardofontes.net
" This code is based on this one: http://www.cmdln.org/wp-content/uploads/2008/10/python_ipdb.vim
" I worked with refactoring and it simplifies a lot the remove breakpoint feature.
" To use this feature, you just need to copy and paste the content of this file at your .vimrc file! Enjoy!
python << EOF
import vim
import re
ipdb_breakpoint = 'import ipdb; ipdb.set_trace()'
@berinhard
berinhard / pop_up_admin_file_widget.py
Created June 14, 2016 16:40
This gist show a solution that I've figured out to open all documents links on model object detail page of Django's admin on a new tab.
class NewTabAdminFileWidget(AdminFileWidget):
"""
This widget is an extensions from AdminFileWidget which is used with all
ImageFields and FileFields at admin forms. This widget follows the api defined
by django.forms.widgets.ClearableFileInput widget.
"""
def __init__(self, *args, **kwargs):
super(NewTabAdminFileWidget, self).__init__(*args, **kwargs)
template_with_initial_new_tab = (
@berinhard
berinhard / pcd-2021.py
Created February 14, 2021 15:20
Trilha Processing Community Day Brasil 2021
# Trilha para vídeo Processing Community Day Brasil 2021
# berin e vinícius
# niterói/lisboa - 14/02/2021 (domingo de carnaval)
Root.default = 'D'
Scale.default = 'minor'
Clock.set_time(0)
Clock.bpm = 120
var.base = var([0, 4, 3, 2, 1], dur=[12, 9, 1, 1, 1])
~d1 >> sinepad(
@berinhard
berinhard / img_symmetry.py
Created November 5, 2020 15:30
Given a set of images from the project thisartworkdoesnotexist.com, this script generates 16 imagens combining symmetries extracts from the image's quadrants.
# Author: Berin
# Sketches repo: https://github.com/berinhard/sketches
# requirements: pillow tqdm
import os
from multiprocessing import Pool
from PIL import Image, ImageOps
from pathlib import Path
from tqdm import tqdm
import shutil
@berinhard
berinhard / py_simetria.py
Created November 5, 2020 15:59
Ess script implementa padrões por rotação e simetria no Processing em modo Python. Ele é uma versão final resultada da preparação para a palestra "Simetrias Pythônicas" apresentada na PythonBrasil 2020 por Bernardo Fontes
# Author: Berin
# Sketches repo: https://github.com/berinhard/sketches
largura = 900
altura = 900
tam_modulo = largura / 2
def modulo():
noStroke()
# quadrado para fundo branco
fill(230)
var total = 5;
function new_image() {
var url = "https://thispersondoesnotexist.com/image";
window.open(url,'_blank');
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
@berinhard
berinhard / pyzza.py
Last active November 4, 2019 15:37
pyzza - processing modo python
from random import choice
PEQUENA, MEDIA, GRANDE, MARACANA = 200, 300, 600, 900
NUM_FATIAS = [4, 8, 12, 16]
def polar_coordinate(x0, y0, r, angle):
x = x0 + r * cos(angle)
y = y0 + r * sin(angle)