Skip to content

Instantly share code, notes, and snippets.

Working from home

Víctor Villalobos viktorvillalobos

Working from home
View GitHub Profile
viktorvillalobos /
Created November 2, 2020 22:02
Generate chunks using python generators.
# based on:
def chunks(iterable, size=10):
iterator = iter(iterable)
for first in iterator:
yield chain([first], islice(iterator, size - 1))
viktorvillalobos /
Last active October 22, 2020 16:07
Data Classes for Django QuerySet filters and exclutions proposal
from __future__ import annotations
from dataclasses import dataclass
from typing import Optional
class Model:
def __init__(self, name: str, age: int) -> None: = name
self.age = age
viktorvillalobos /
Created August 3, 2018 18:13
Selenium scraping class with chrome and headless mode.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class WebDriver:
def __init__(self, headless=True):
self.options = webdriver.ChromeOptions()
viktorvillalobos /
Created September 25, 2015 01:16 cx_freeze + Python3.4 + PyQt5 + Requests
from cx_Freeze import setup, Executable
import requests.certs
build_exe_options = \