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 / comparacion_resultados.md
Created June 2, 2018 18:40
comparacion resultados json

ejemplo de arica para allData_ddl_legend.json

 {
    "agno": 2016,
     "cod_com_alu": 15102,
     "cod_com_rbd": 15101,
     "cod_reg": 15,
     "flow": 64,
     "lat_com_alu": -19.155567,
     "lat_com_rbd": -18.47895865,
@diegoquintanav
diegoquintanav / after-install.md
Last active July 4, 2018 01:50
fresh install
  1. Fresh install bionic beaver
    1. Update dependencies
    2. sudo apt-get install -y git curl tmux weechat net-tools
  2. Install pyenv
    1. Install build dependencies as stated in https://github.com/pyenv/pyenv/wiki sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev
    2. Install pyenv
    3. env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.0 or whatever version you like. --enable-shared is needed for other packages to work properly, like vundle.
  3. install docker-ce
  4. Follow post installation tasks for Ubuntu

Docker aliases

# Show the ip address of the container
alias dip="docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'"

# Show the ID of the last container used
alias dlq="docker ps -lq"
@diegoquintanav
diegoquintanav / .vimrc
Last active June 29, 2018 20:04
vimrc file
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
" check https://github.com/VundleVim/Vundle.vim for details
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@diegoquintanav
diegoquintanav / .gitconfig
Last active March 26, 2020 15:04
git config file
[user]
email = daquintanav@gmail.com
name = Diego Quintana
[alias]
a = add
co = checkout
st = status
ci = commit
br = branch
unstage = reset HEAD --
@diegoquintanav
diegoquintanav / rename_files.py
Last active March 25, 2020 09:25
rename files using python
# basic renaming of files, to enforce a minimum consistency
from pathlib import Path
for ix, file in enumerate(sorted(Path.cwd().glob('*'))):
new_filename = f'{ix:02}_' + file.name.lower().replace(' ','_')
print(f'{file.name} > {new_filename}')
file.rename(new_filename)
@diegoquintanav
diegoquintanav / test_stuff.md
Created October 9, 2018 20:35
migrate unittests to pytest in Flask

Migrate from python.unittest to pytest

Check http://flask.pocoo.org/docs/1.0/testing/

# test_stuff.py

class StuffTestCase(unittest.TestCase):
    def setUp(self):
        self.app = create_app('testing') # app factory
@diegoquintanav
diegoquintanav / config.py
Last active March 25, 2020 09:26
instance configuration in Flask
## instance/config.py
HELLO_ENABLED = False
@diegoquintanav
diegoquintanav / extra_dependencies_gitlab.md
Last active January 16, 2019 23:27
installing `extra_requires` dependencies from private git repositories

The struggle is real: Basically this bit in a setup.py worked for me.

extras_require={
        'extrapackage':  ["git@git+ssh://git@gitlab.com/<user>/<repository_name>.git"],
        },

then it's possible to do pip install -e .[extrapackage] given you have proper ssh access

@diegoquintanav
diegoquintanav / fizzbuzz.py
Last active March 25, 2020 09:24
fizzbuzz
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
"""