Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Giuliano Oliveira giuliano-oliveira

🏠
Working from home
  • Brazil
View GitHub Profile
@giuliano-oliveira
giuliano-oliveira / focus_node_mem_leak_test.dart
Created Jun 2, 2020
FocusScope.of(context).requestFocus(new MyFocusNode()) memleak test
View focus_node_mem_leak_test.dart
import 'package:flutter/material.dart';
class MyFocusNode extends FocusNode {
MyFocusNode() : super() {
print("constructor");
}
@override
void dispose() {
print("dispose");
@giuliano-oliveira
giuliano-oliveira / wpp_video_splitter.py
Last active Jul 9, 2020
Split video using ffmpeg to fit WhatsApp status
View wpp_video_splitter.py
from subprocess import getstatusoutput as shell
from subprocess import Popen,PIPE,STDOUT
import shlex
import re
import argparse
import os
from tqdm import tqdm
from math import ceil,log10
def get_video_length(fname):
@giuliano-oliveira
giuliano-oliveira / modes.json
Last active Aug 31, 2020
Workout timer written in python using curses
View modes.json
[
{
"name":"REP",
"time_seconds":60
},
{
"name":"SWITCH",
"time_minutes":3
}
]
@giuliano-oliveira
giuliano-oliveira / random_particles.py
Last active Aug 31, 2020
Generate n random particles with random velocity vectors in python using curses
View random_particles.py
import curses
from time import time,sleep
from random import randrange,random
from math import cos,sin,pi
import argparse
class TUI:
FPS=60
def __init__(self,screen,no_particles):
@giuliano-oliveira
giuliano-oliveira / pandoc.py
Created Aug 28, 2020
pandoc + nodemon tool, need eisvogel template
View pandoc.py
#!/usr/bin/env python3
import argparse
import os
parser=argparse.ArgumentParser()
parser.add_argument("input",type=str)
args=parser.parse_args()
out_pdf=os.path.splitext(os.path.split(args.input)[-1])[0] +".pdf"
View make_blobs_test.py
from sklearn.datasets import make_blobs
# import pandas as pd
import numpy as np
centers=[
[.1,.1],
[.2,.1],
[.3,.1],
[.4,.1],
[.5,.1],
View tenha_uma_boa_semana.py
from io import StringIO
from random import gauss,randrange
max_chars=63206 #https://sproutsocial.com/insights/social-media-character-counter/
wrong="9"
right="6"
f=StringIO()
View notebook.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@giuliano-oliveira
giuliano-oliveira / psyche.py
Created Oct 7, 2020
using contextlib+signals to make a with timeout with statement
View psyche.py
import signal
from contextlib import contextmanager
class TimeOutError(RuntimeError):pass
@contextmanager
def timeout(duration):
def timeout_handler(signum, frame):
raise TimeOutError()
signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(duration)
try:
@giuliano-oliveira
giuliano-oliveira / gdown_folder.py
Created Oct 25, 2020
Shallow download files from Google drive folder using gdown and selenium
View gdown_folder.py
from bs4 import BeautifulSoup
from selenium import webdriver
import gdown
import argparse
parser=argparse.ArgumentParser()
parser.add_argument("url")
args=parser.parse_args()