Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
Working from home

Diego Quintana diegoquintanav

🐢
Working from home
View GitHub Profile
View process_data.py
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 / mountdocker.md
Created Mar 19, 2021
change mount point for docker containers
View mountdocker.md

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. Change in/etc/docker/daemon.json graph to new path
@diegoquintanav
diegoquintanav / convert-to-pdf
Last active Jan 17, 2021
shrink slides or pdfs to nxm sheets per page
View convert-to-pdf
#!/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 / ABOUT.md
Last active Dec 3, 2020
docker-compose for graph-tool
View ABOUT.md
View news-count.csv
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
@diegoquintanav
diegoquintanav / ABOUT.md
Created Sep 21, 2019
Toy postgres instance with `pgadmin4` and docker compose
View ABOUT.md

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 test@test.com and test as password
  3. Access the database with the test password
  4. You have a database to play!
@diegoquintanav
diegoquintanav / palindromes_with_jutge.md
Last active Sep 21, 2019
working around Jutge's evaluation method
View palindromes_with_jutge.md

Given the requirements.txt file

pytest
jutge

Consider the palindrome problem in palindrome.py

@diegoquintanav
diegoquintanav / git-events.md
Last active Aug 30, 2019
events describing error using an interactive rebase, and going back
View git-events.md

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 / footer-flask-bootstrap.md
Last active Oct 15, 2020
Defining a footer with flask-bootstrap
View footer-flask-bootstrap.md
View fizzbuzz.py
import sys [0/6141]
"""A simple python implementation of the FizzBuzz problem.
*caveat*: It considers zero as divisible by three and five
see https://www.google.com/search?client=ubuntu&channel=fs&q=fizzbuzz+problem&ie=utf-8&oe=utf-8
and http://wiki.c2.com/?FizzBuzzInManyProgrammingLanguages
"""