Skip to content

Instantly share code, notes, and snippets.

View eduzen's full-sized avatar
🎯
Focusing

Eduardo Enriquez eduzen

🎯
Focusing
View GitHub Profile
@eduzen
eduzen / motion_light_night_aware.yaml
Last active January 16, 2023 12:17
motion_light_night_aware
blueprint:
name: Motion-activated Light Night Aware
description: Turn on a light when motion is detected.
domain: automation
source_url: https://github.com/eduzen/3f39d019300ee660803b33af931061c4
input:
motion_entity:
name: Motion Sensor
selector:
entity:
@eduzen
eduzen / app.py
Created February 5, 2022 20:09
busqueda de pelis en yify
import requests
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"
from functools import wraps
import time
def try_until_you_find_it(retries=1, wait_time=1):
def decorator(func):
@wraps(func)
def wrapped_func(*args, **kwargs):
for n in range(retries):
try:
return func(*args, **kwargs)
GLOB sdist-make: /home/eduzen/Projects/personal/pip/setup.py
py39 inst-nodeps: /home/eduzen/Projects/personal/pip/.tox/.tmp/package/1/pip-21.3.dev0.zip
py39 installed: attrs==21.2.0,cffi==1.14.6,coverage==5.5,cryptography==3.4.8,execnet==1.9.0,freezegun==1.1.0,iniconfig==1.1.1,packaging==21.0,pip @ file:///home/eduzen/Projects/personal/pip/.tox/.tmp/package/1/pip-21.3.dev0.zip,pluggy==1.0.0,py==1.10.0,pycparser==2.20,pyparsing==2.4.7,pytest==6.2.5,pytest-cov==2.12.1,pytest-forked==1.3.0,pytest-rerunfailures==10.1,pytest-xdist==2.3.0,python-dateutil==2.8.2,scripttest==1.3,setuptools==57.4.0,six==1.16.0,toml==0.10.2,tomli_w==0.3.0,virtualenv==16.7.12,Werkzeug==2.0.1,wheel==0.36.2
py39 run-test-pre: PYTHONHASHSEED='4044394296'
py39 run-test-pre: commands[0] | python -c 'import shutil, sys; shutil.rmtree(sys.argv[1], ignore_errors=True)' /home/eduzen/Projects/personal/pip/tests/data/common_wheels
py39 run-test-pre: commands[1] | python /home/eduzen/Projects/personal/pip/tools/tox_pip.py wheel -w /home/eduzen/Proj
@eduzen
eduzen / gist:f7746d595900d2bfd73d3f81f43bf7ad
Created September 11, 2021 14:29
tests/unit/test_req_file.py:573
tests/unit/test_req_file.py:573:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/unit/test_req_file.py:59: in parse_reqfile
for parsed_req in parse_requirements(
.tox/py39/lib/python3.9/site-packages/pip/_internal/req/req_file.py:135: in parse_requirements
for parsed_line in parser.parse(filename, constraint):
.tox/py39/lib/python3.9/site-packages/pip/_internal/req/req_file.py:316: in parse
yield from self._parse_and_recurse(filename, constraint)
.tox/py39/lib/python3.9/site-packages/pip/_internal/req/req_file.py:321: in _parse_and_recurse
for line in self._parse_file(filename, constraint):
FAILED tests/unit/test_finder.py::test_finder_installs_pre_releases_with_version_spec - AssertionError: You can only turn file: urls into filenames (not 'ht...
FAILED tests/unit/test_req_file.py::TestParseRequirements::test_remote_reqs_parse - pip._vendor.requests.exceptions.ConnectionError: HTTPSConnectionPool(hos...
FAILED tests/unit/test_network_lazy_wheel.py::test_dist_from_wheel_url - pip._vendor.requests.exceptions.ConnectionError: HTTPSConnectionPool(host='files.py...
====================================== 3 failed, 1399 passed, 11 skipped, 4 xfailed, 1 xpassed, 2285 warnings in 11.68s ====================================
@eduzen
eduzen / docker-compose.yml
Created February 2, 2020 17:22
dynamo-db-admin
version: "3"
services:
pydy:
build: .
env_file:
- ./.env
volumes:
- .:/code
import boto3
from configparser import ConfigParser
from pathlib import Path
def _get_profiles():
credentials_file = Path.home() / ".aws" / "credentials"
config = ConfigParser()
config.read(credentials_file)
return config.sections()
import redis
from django.core.cache import cache
from functools import wraps
def single_instance_task(function=None, key="", timeout=None):
"""Enforce only one celery task at a time."""
@wraps(func)
def _task_execution(run_func):
@eduzen
eduzen / celery_singleton.py
Created October 11, 2019 20:26
Ensuring a task is only executed one at a time
import redis
REDIS_CLIENT = redis.Redis()
def only_one(function=None, key="", timeout=None):
"""Enforce only one celery task at a time."""
def _dec(run_func):
"""Decorator."""