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

A Quick Guide to Big-O Notation, Memoization, Tabulation, and Sorting Algorithms by Example

Curating Complexity: A Guide to Big-O Notation


A Quick Guide to Big-O Notation, Memoization, Tabulation, and Sorting Algorithms by Example

Curating Complexity: A Guide to Big-O Notation

@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
@taiwotman
taiwotman / flasks_py2neo.py
Last active December 31, 2022 15:45
FlaskLogin Neo4j
from __future__ import absolute_import
from flask import current_app
from py2neo import Graph
import os
username = os.environ.get('NEO4J_USERNAME')
password = os.environ.get('NEO4J_PASSWORD')
class Py2Neo(object):
def __init__(self, app=None):
@rkaneko
rkaneko / sample.py
Created February 17, 2020 13:42
Put parquet file on MinIO (S3 compatible storage) using pyarrow and s3fs.
from typing import Any, Dict, List
import s3fs
from pyarrow import Table, parquet as pq
from pandas import DataFrame, Series
def to_df(data: List[Dict[str, Any]]) -> DataFrame:
df = DataFrame()
for item in data:
indexes = []
values = []
@deehzee
deehzee / autoreload.md
Last active December 1, 2021 19:48
Auto reload of modules in jupyter notebook

Module autoreload

To auto-reload modules in jupyter notebook (so that changes in files *.py doesn't require manual reloading):

# for auto-reloading external modules
# see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython
%load_ext autoreload
%autoreload 2
@mwenger1
mwenger1 / DatabaseResources.md
Last active January 21, 2025 09:02
Commonly Used SQL/Active Record/Database Snippets

Query Syntax

SELECT now() - query_start as "runtime", usename, datname, waiting, state, query
  FROM  pg_stat_activity
  WHERE now() - query_start > '2 minutes'::interval
 ORDER BY runtime DESC;

Migrations

@first087
first087 / README.md
Created December 29, 2016 02:21
Script for attach drive D: into Docker Toolbox for Windows

How to use script

  1. Run Docker Toolbox from shortcut Docker Quickstart Terminal
  2. Shutdown boot2docker docker-machine stop
  3. Open VirtualBox and goto Settings of default machine
  4. At Shared Folders menu, click + icon, Select folder path to drive D: and set folder name is d, checked all options
  5. Copy attach-drive-d.sh script to Docker Toolbox folder (C:\Program Files\Docker Toolbox)
  6. Edit start.sh add command sh attach-drive-d.sh before finalize step
  7. Run Docker Toolbox from shortcut Docker Quickstart Terminal again
  8. Have fun!!!
@ivanleoncz
ivanleoncz / flask_app_logging.py
Last active February 26, 2025 21:14
Demonstration of logging feature for a Flask App.
#/usr/bin/python3
""" Demonstration of logging feature for a Flask App. """
from logging.handlers import RotatingFileHandler
from flask import Flask, request, jsonify
from time import strftime
__author__ = "@ivanleoncz"
import logging
@barseghyanartur
barseghyanartur / install-xapian.sh
Last active November 16, 2024 17:25 — forked from areski/install-xapian
Install xapian Core and Bindings with Python support on Ubuntu 14.04 LTS
# *****************************************************
# ***************** Install xapian Core ***************
# *****************************************************
sudo apt-get install zlib1g-dev
sudo apt-get install g++
sudo apt-get install uuid-dev
curl -O http://oligarchy.co.uk/xapian/1.2.18/xapian-core-1.2.18.tar.xz
curl -O http://oligarchy.co.uk/xapian/1.2.18/xapian-bindings-1.2.18.tar.xz