Skip to content

Instantly share code, notes, and snippets.

View Ronald-TR's full-sized avatar
:shipit:
Stealth

Ronald Ronald-TR

:shipit:
Stealth
View GitHub Profile
@Ronald-TR
Ronald-TR / pipe_in_python.py
Last active November 20, 2019 12:06
Simple implementation of pipe operator into your functions: https://code.sololearn.com/ca4QB7ZEM91L/#py
"""Cause the fstrings notation into the example 'congrats' functions,
the examples only works in python 3.8.
"""
from functools import partial
class Pipe:
def __init__(self, function):
self.function = function
import requests
import csv
import json
from datetime import datetime
import locale
locale.setlocale(locale.LC_ALL, 'pt_BR.UTF-8')
def extract_cpf_mesano(row):
cpf = row['CPF'].strip()
@Ronald-TR
Ronald-TR / live_terminal.py
Created June 22, 2020 17:42
Simple live reload for terminal applications, refresh the terminal everytime that the file changes.
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import sys
import os
import time
import subprocess as subp
FILENAME = sys.argv[1]
PROC = None
@Ronald-TR
Ronald-TR / reload.sh
Created January 14, 2022 17:45
Run command when file changes
# sudo pacman -S inotify-tools
# chmod +x reload.sh
FILE=diagram.py
while inotifywait -e close_write $FILE; do python $FILE; done