Skip to content

Instantly share code, notes, and snippets.

View guibeira's full-sized avatar
🏠
Working from home

Guilherme de S. Vieira Beira guibeira

🏠
Working from home
View GitHub Profile
@guibeira
guibeira / output.json
Last active June 30, 2023 13:41
Example of how to load game_of_life payload
[
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0],
[1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0],
[0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0],
@guibeira
guibeira / base_client.py
Created June 26, 2023 14:47
Sample of base client
import asyncio
import json
from functools import partial
from typing import Any, Dict, List, Optional, Type, TypeVar, Union
import httpx
from pydantic import BaseModel, Field
T = TypeVar("T", bound=BaseModel)
@guibeira
guibeira / join_example.py
Created February 23, 2023 19:10
Simple solution for create batch and query nested objects
from uuid import uuid4
from collections import defaultdict
import uuid
from pydantic import BaseModel, Field
from pydantic.types import UUID4
from sqlalchemy import Column, MetaData, Table, create_engine, text, ForeignKey
from sqlalchemy.sql import select
from sqlalchemy.dialects import postgresql
DATABASE_NAME = "sqlalchemy_test"
@guibeira
guibeira / docker-compose.yml
Created January 30, 2023 23:06
Media center
version: '3.8'
services:
pms-docker:
container_name: plex
network_mode: host
hostname: plex
# runtime: nvidia
environment:
- TZ=America/Sao_Paulo
- PLEX_UID=1000
@guibeira
guibeira / search_linkedin.js
Last active February 1, 2023 01:35
small script to search content in job description
const timer = ms => new Promise(res => setTimeout(res, ms))
async function search(content) {
// // adjust the zoom level
// get list of jobs
let has_jobs = true
while (has_jobs) {
let scrolling = 0
const pg_button = document.getElementsByClassName("artdeco-pagination__indicator selected")
const next = pg_button[0].nextElementSibling
const jobs = document.getElementsByClassName("job-card-list__entity-lockup")
@guibeira
guibeira / .pre-commit-config.yaml
Last active June 5, 2023 14:25
Pre commit on work folders
repos:
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: master
hooks:
- id: forbid-space-in-indent
types: [python]
@guibeira
guibeira / dolar.sh
Created July 1, 2022 15:19
dolar hj cli
#!/usr/bin/env bash
curl -m 1 https://economia.awesomeapi.com.br/last/USD-BRL | jq -r '.USDBRL.bid' | awk '{print "BRL "$0}'
@guibeira
guibeira / deploy_music.sh
Last active December 29, 2019 02:58
deploy music
#!/bin/bash
echo $(pip install --upgrade youtube-dl)
echo $(youtube-dl -f 251 https://www.youtube.com/watch?v=mjjkHg5FOhk -o - | ffplay -nodisp -autoexit -i -)
@guibeira
guibeira / play.sh
Last active December 28, 2019 23:34
play youtube music on cli
#!/bin/bash
echo $(pip install --upgrade youtube-dl)
args=("$@")
echo $args
echo $(youtube-dl -f 251 ${args[0]} -o - | ffplay -nodisp -autoexit -i -)
@guibeira
guibeira / connect_db
Created November 2, 2019 17:46
easy way to connect to database using heroku name
#!/bin/bash
default_db="heroku config:get DATABASE_URL --app "
args=("$@")
DATABASE_URL=$($default_db ${args[0]})
PG_WEB="pgweb --url"
echo $(xdg-open http://localhost:8081/)
echo $($PG_WEB $DATABASE_URL)