Skip to content

Instantly share code, notes, and snippets.

Avatar

Marco Rougeth rougeth

View GitHub Profile
View cut_and_concat.py
import sys
import toml
from slugify import slugify
def load_config_file():
try:
path = sys.argv[1]
except IndexError:
@rougeth
rougeth / pyne.py
Created Aug 1, 2021
Robô da Python Nordeste 2020/2021
View pyne.py
import discord
from discord.ext import commands
from decouple import config
DISCORD_TOKEN = config("DISCORD_TOKEN")
bot = commands.Bot(command_prefix="pyne!", intents=discord.Intents.default())
View cut_and_concat.sh
function cut_and_concat ()
{
SOURCE=$PWD/$1
OUTPUT=$PWD/$2
OPENING=$PWD/$3
START_AT=$4
END_AT=$5
TIMESTAMP=$(date +"%Y%m%d%H%M%S")
@rougeth
rougeth / README.md
Last active May 14, 2022
Script para gerar os certificados da Python Brasil
View README.md
@rougeth
rougeth / pybr20-foto-oficial.py
Created Nov 8, 2020
Script gerador da foto oficial da Python Brasil 2020
View pybr20-foto-oficial.py
import asyncio
import sys
from pathlib import Path
import discord
from PIL import Image
def gerar_imagem():
imagens = [
@rougeth
rougeth / async_rotina.py
Created Apr 21, 2018
Async que se faz - TDC 2018
View async_rotina.py
# Código usado na palestra "Async que se faz - asyncio na prática"
# no TDC 2018 em Florianópolis
# Creative Commons Attribution 4.0 International license <https://creativecommons.org/licenses/by/4.0/>
import asyncio
import random
from time import sleep
from utils import UPDATE_AVG, async_request, timeit
@rougeth
rougeth / utils.py
Created Apr 21, 2018
Async que se faz - TDC 2018
View utils.py
# Código usado na palestra "Async que se faz - asyncio na prática"
# no TDC 2018 em Florianópolis
# Creative Commons Attribution 4.0 International license <https://creativecommons.org/licenses/by/4.0/>
# requirements: termcolor
import random
import asyncio
from asyncio import sleep as async_sleep
from time import time, sleep as sync_sleep
@rougeth
rougeth / sync_rotina.py
Created Apr 21, 2018
Async que se faz - TDC 2018
View sync_rotina.py
# Código usado na palestra "Async que se faz - asyncio na prática"
# no TDC 2018 em Florianópolis
# Creative Commons Attribution 4.0 International license <https://creativecommons.org/licenses/by/4.0/>
import random
from time import sleep
from utils import UPDATE_AVG, sync_request
View arquivo.py
def hello_world():
print('hello world')
hello_world()
if __name__ == '__main__':
print('dentro do if')
hello_world()
View center.py
from functools import reduce
def center(words):
max_length = reduce(lambda a, b: a if a > len(b) else len(b), words, 0)
words = [word if len(word) == max_length else '{}{}'.format(' ' * ((max_length - len(word)) // 2), word) for word in words]
for word in words: print(word)