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 / footer-flask-bootstrap.md
Last active October 15, 2020 19:25
Defining a footer with flask-bootstrap
@diegoquintanav
diegoquintanav / git-events.md
Last active August 30, 2019 16:23
events describing error using an interactive rebase, and going back

So I messed up with git

TL;DR

  1. Everything is under control
  2. Did an interactive rebase to move a commit to the base of my branch, forgot to include merge commits
  3. Lost my merge commits
  4. Tried to go back with git reset --hard and reflog
  5. Ended up at the base of my branch, with my unrebased commits dangling after it
  6. Want to move back to step 0, and hopefully do step 1 again, but including merge commits.
@diegoquintanav
diegoquintanav / palindromes_with_jutge.md
Last active September 21, 2019 10:32
working around Jutge's evaluation method

Given the requirements.txt file

pytest
jutge

Consider the palindrome problem in palindrome.py

@diegoquintanav
diegoquintanav / ABOUT.md
Created September 21, 2019 11:42
Toy postgres instance with `pgadmin4` and docker compose

Getting a postgres instance with pgadmin4 🐘 and docker-compose 🐳

  1. Use Linux and have docker and docker-compose installed.
  2. Create a folder
  3. Put docker-compose.yml and servers.json
  • Optional: Put a SQL script to be executed at first run from the db service.
  1. docker-compose up -d
  2. Go to 0.0.0.0:5050 and login with [email protected] and test as password
  3. Access the database with the test password
  4. You have a database to play!
We can't make this file beautiful and searchable because it's too large.
5785, 0
11, 0,0
1, 0,0,0
1, 0,0,100,100
8, 0,1
1, 0,24
1, 0,8192
87, 0.0
49, 0.00
10, 0.000
@diegoquintanav
diegoquintanav / ABOUT.md
Last active April 5, 2022 09:16
docker-compose for graph-tool
@diegoquintanav
diegoquintanav / convert-to-pdf
Last active January 17, 2021 17:46
shrink slides or pdfs to nxm sheets per page
#!/bin/bash
# converts to pdf all txt files in a folder
# and produces a single pdf of all of them together
for filename in $(ls *.txt); do
libreoffice --convert-to "pdf" "$filename"
done
@diegoquintanav
diegoquintanav / mountdocker.md
Last active May 20, 2023 12:01
change mount point for docker containers

I want docker to stop using my root partition for storing docker containers, and use a different partition instead, e.g. /home

These steps worked for me:

  1. Stop all containers sudo docker stop $(docker ps -a -q)
  2. Stop docker sudo service docker stop
  3. Copy docker directory cp -r /var/lib/docker/* /home/docker/
  4. Unmount all old docker overlays umount -f /var/lib/docker/overlay/ and umount -f /var/lib/docker/containers/*/mounts/shm
  5. Add or update /etc/docker/daemon.json with
@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
@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