Skip to content

Instantly share code, notes, and snippets.

View NumberPiOso's full-sized avatar

Pablo Osorio López NumberPiOso

View GitHub Profile
@NumberPiOso
NumberPiOso / conexion_postgresql_wsl2.md
Last active December 15, 2020 17:30
Corregir doble backslash

Problema en la conexión a servidor postgresql en Windows desde WSL 2

Al cambiarse a WSL 2 desde WSL pueden salir errores de conexión a la base de datos. Esto causado a que como WSL 2 se comporta más como una maquina virtual, tiene su propia IP. Esto puede causar problemas en comandos y aplicaciones que antes corrían en WSL 1 sin ningún problema. Es una carácteristica no deseada que ya está documentada Comparing WSL 1 and WSL 2.

Búsqueda de IP

@jakebrinkmann
jakebrinkmann / connect_psycopg2_to_pandas.py
Created July 3, 2017 14:19
Read SQL query from psycopg2 into pandas dataframe
import pandas as pd
import pandas.io.sql as sqlio
import psycopg2
conn = psycopg2.connect("host='{}' port={} dbname='{}' user={} password={}".format(host, port, dbname, username, pwd))
sql = "select count(*) from table;"
dat = sqlio.read_sql_query(sql, conn)
conn = None
@tasdikrahman
tasdikrahman / python_tests_dir_structure.md
Last active June 30, 2024 00:15
Typical Directory structure for python tests

A Typical directory structure for running tests using unittest

Ref : stackoverflow

The best solution in my opinion is to use the unittest [command line interface][1] which will add the directory to the sys.path so you don't have to (done in the TestLoader class).

For example for a directory structure like this:

new_project

├── antigravity.py