Skip to content

Instantly share code, notes, and snippets.

View diegoquintanav's full-sized avatar
🐢
Working from home

Diego Quintana diegoquintanav

🐢
Working from home
View GitHub Profile
@diegoquintanav
diegoquintanav / parse_readme.py
Last active August 28, 2024 11:06
test de prova
import re
from pathlib import Path
import argparse
from typing import Dict, List, Optional
import json
def parse_doc_comments(readme_content: str) -> List[str]:
"""Parse DOC comments in the form <!-- [DOC-*] --> from the README.md content."""
pattern = r"<!--\s*\[\s*(.*?)\s*\]\s*-->"
@diegoquintanav
diegoquintanav / instructions-install-eduroam-upc.md
Last active March 22, 2024 14:22
How to connect to eduroam signal using UPC setup

Why

Setting up an eduroam connection using UPC (Universitat Politècnica de Catalunya) instructions was not easy to me. Particularly the dbus part fails silently.

This was tested on Linux Mint 21.1

Steps

  1. Have linux and python installed
  2. Download python script from https://cat.eduroam.org/ at SOME_PATH
@diegoquintanav
diegoquintanav / Dockerfile
Created September 21, 2022 19:38
docker-compose for lambdalabs machine
from continuumio/miniconda3:latest
RUN mkdir -p /src/notebooks
WORKDIR /src/notebooks
COPY notebooks/environment.yml notebooks/requirements.txt /src/notebooks/
RUN conda env create -f environment.yml
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
@diegoquintanav
diegoquintanav / encrypt_secrets.md
Created May 25, 2022 15:46
Encrypt secrets in git

Commiting secrets to git

Don’t

Don’t commit secrets to github.

Do

  • Use vaults or other systems
  • use environment variables when possible
@diegoquintanav
diegoquintanav / README.md
Last active May 15, 2022 19:35
borrador nueva constitución

Borrador nueva constitución 2022

En texto plano para análisis. Descargado de

FROM python:3.9
# passed from docker-compose.services.service.env_file
ARG PIPY_USER
ARG PIPY_PASS
ENV PIP_NO_CACHE_DIR off
ENV PIP_DISABLE_PIP_VERSION_CHECK on
ENV PIP_DEFAULT_TIMEOUT 100
ENV POETRY_HOME /opt/poetry
@diegoquintanav
diegoquintanav / move_downloads_selenium.py
Last active March 26, 2022 15:13
Move downloaded files to another folder using selenium
from pathlib import Path
import time
# adapted from https://stackoverflow.com/questions/23896625/how-to-change-default-download-folder-while-webdriver-is-running
def move_to_download_folder(
download_dir: Path,
new_destination_dir: Path,
lookup_str: str,
wait_seconds: int = 5,
max_tries: int = 3,
@diegoquintanav
diegoquintanav / attention_app.py
Created October 29, 2021 06:49
streamlit scaled dot product attention app
# needs streamlit and python>=3.7
import torch
import urllib
import altair as alt
import dataclasses
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
@diegoquintanav
diegoquintanav / process_data.py
Created April 19, 2021 16:50
convert csv to npz
import argparse
import json
import os
import re
import threading
from pathlib import Path
import numpy as np
import pandas as pd
import requests