This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
srun --gres=local:50 --job-name "notebook" --mem 20GB --time 2:00:00 --pty bash -i | |
uv run marimo edit notebooks/ --port 8885 --headless --host 0.0.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from pathlib import Path | |
from typing import Optional | |
from huggingface_hub import snapshot_download | |
""" | |
Mandatory: downloading HugginFace Hub CLI https://huggingface.co/docs/huggingface_hub/v0.19.1/en/guides/cli | |
Usage: hf download <wanted model> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 100% stacked bar of null vs not-null values | |
_proportion = [] | |
for _col, _valid, _nulls in zip(raw_df.columns, raw_df.count(), raw_df.null_count()): | |
_total = _valid[0] + _nulls[0] | |
_not_null = _valid[0]/_total | |
_nulls = _nulls[0]/_total | |
_proportion.append({"column": _col, "status": "not-null", "proportion": _not_null}) | |
_proportion.append({"column": _col, "status": "null", "proportion": _nulls}) | |
print(f"{_col} not-null {_not_null:.2f}% null {_nulls:.2f}%") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias nbib2bib='f(){ nbib2xml "$1" | xml2bib -b; unset -f f; }; f' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source: https://stackoverflow.com/a/72778999 | |
python -m venv venv | |
source venv/bin/activate | |
ipython kernel install --user --name=venv | |
jupyter notebook | |
go to kernel-->change kernel-->choose the venv from the dropdown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gitlab.mister-muffin.de/josch/img2pdf | |
ls *.jpg | sort -n | tr '\n' ' ' | xargs img2pdf -o ebook.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import asdict | |
import json | |
json.dump(asdict(my_object), open("my_object.json", "w")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
def retrieve_errors(issue_id): | |
issue_id = "" # FIXME | |
endpoint = f"https://sentry.io/api/0/issues/{issue_id}/events/?full=True" | |
token = "" # FIXME | |
headers = {"Authorization": f"Bearer {token}"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
codigo_cidade_tse | municipio | sigla_estado | codigo_prefeito_tse | nome_urna | url | |
---|---|---|---|---|---|---|
31011 | Amparo de São Francisco | SE | 260000686461 | ALZIRA DE SALETE | https://divulgacandcontas.tse.jus.br/candidaturas/oficial/2020/SE/31011/426/candidatos/401877/5_1600439475109.pdf | |
31011 | Amparo de São Francisco | SE | 260000663375 | ATEVALDO | https://divulgacandcontas.tse.jus.br/candidaturas/oficial/2020/SE/31011/426/candidatos/361378/5_1600363475075.pdf | |
31011 | Amparo de São Francisco | SE | 260001234505 | FRANKLIN FREIRE | https://divulgacandcontas.tse.jus.br/candidaturas/oficial/2020/SE/31011/426/candidatos/780356/5_1601143241998.pdf | |
31038 | Aquidabã | SE | 260000863851 | ANDERSON ANDRADE | https://divulgacandcontas.tse.jus.br/candidaturas/oficial/2020/SE/31038/426/candidatos/583189/Proposta.pdf | |
31038 | Aquidabã | SE | 260000660580 | DR MÁRIO LUCENA | https://divulgacandcontas.tse.jus.br/candidaturas/oficial/2020/SE/31038/2030402020/260000660580/pje-d2d8f962-Proposta de governo.pdf | |
31038 | Aquidabã | SE | 260001041576 | DR PHILIPPE | https://divulgacandcontas.tse.jus.br/candidaturas |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scrapy | |
class ImprensaOficialSpider(scrapy.Spider): | |
start_urls = ["http://www.imprensaoficial.org/acesso.htm"] | |
# example http://pmameliarodriguesba.imprensaoficial.org/ | |
name = "imprensa_oficial" | |
TERRITORY_ID = None | |
handle_httpstatus_list = [301] |
NewerOlder