INSERT GRAPHIC HERE (include hyperlink in image)
Subtitle or Short Description Goes Here
from sqlalchemy import Table, MetaData, create_engine | |
from sqlalchemy.engine import reflection | |
# Configurações de conexão abstraídas em variáveis de ambiente setadas num arquivo .env | |
DB_USER = os.getenv('DB_USER') | |
DB_PASS = os.getenv('DB_PASS') | |
DB_HOST = os.getenv('DB_HOST') | |
DB_NAME = os.getenv('DB_NAME') | |
SQLALCHEMY_DATABASE_URL = f"postgresql+psycopg2://{DB_USER}:{DB_PASS}@{DB_HOST}:5432/{DB_NAME}" |
import pandas as pd | |
import numpy as np | |
import fastparquet | |
from sqlalchemy import create_engine, schema, Table | |
# Copied from pandas with modifications | |
def __get_dtype(column, sqltype): | |
import sqlalchemy.dialects as sqld |
init python: | |
class DynamicBlink(renpy.display.layout.DynamicDisplayable): | |
""" | |
A dynamic image that blinks every now and then | |
""" | |
def __init__(self, *args, **kwargs): | |
self.current_image = args[1] | |
self.blink_st = -1.0 # arbitrary number to force normal start |
#!/bin/bash | |
#Removes old revisions of snaps | |
#CLOSE ALL SNAPS BEFORE RUNNING THIS | |
set -eu | |
LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' | | |
while read snapname revision; do | |
snap remove "$snapname" --revision="$revision" | |
done |
import cProfile, pstats, StringIO | |
pr = cProfile.Profile() | |
pr.enable() | |
# ... do something ... | |
pr.disable() | |
s = StringIO.StringIO() | |
ps = pstats.Stats(pr, stream=s).sort_stats(‘cumulative’) | |
ps.print_stats() |
#!/usr/bin/env python | |
import tkinter as tk | |
import math | |
import re | |
from collections import ChainMap | |
Nrows = 5 | |
Ncols = 5 |
#!/bin/bash | |
# Adicione um novo remote; pode chamá-lo de "upstream": | |
git remote add upstream https://github.com/usuario/projeto.git | |
# Obtenha todos os branches deste novo remote, | |
# como o upstream/master por exemplo: | |
git fetch upstream |
You may want to upload a 100GB file over an unstable network, or feed your scripts smaller inputs to load in RAM. In both cases, just splitting your file into smaller chunks is an easy solution.
Great news is Unix/Linux systems have the split
utility already installed. And using it is simple as pie:
Cut a binary file into chunks of X bytes:
split -b X bigfile.avi
# enable color support of ls and also add handy aliases | |
if [ -x /usr/bin/dircolors ]; then | |
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
alias ls='ls --color=auto' | |
alias grep='grep --color=auto' | |
fi | |
# some more ls aliases | |
alias ll='ls -la -h' | |