Skip to content

Instantly share code, notes, and snippets.

@armindocachada
armindocachada / pifu-demo-with-pytorch-downgraded.ipynb
Created August 6, 2022 16:20
PIFu Demo with pytorch downgraded
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@armindocachada
armindocachada / raspberry-pi-wildlife-camera-train-image-classification-model.ipynb
Last active August 6, 2022 16:21
raspberry pi wildlife camera train image classification model.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@armindocachada
armindocachada / amazon-price-scraper-sends-whatsapp-notifications.ipynb
Created September 19, 2021 15:43
Amazon Price Scraper with WhatsApp Notifications
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@armindocachada
armindocachada / ebay_price_tracker_3060.ipynb
Created March 29, 2021 21:44
Python notebook for YouTube Video: Web Scraping with Python, Selenium and BeautifulSoup for RTX 3060 Ebay sold prices - https://www.youtube.com/watch?v=zpBIJLdODks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@armindocachada
armindocachada / spinning_donut_blender.py
Created March 26, 2021 16:49
Spinning Donut written with Python and Blender
import bpy
from PIL import Image
import numpy as np
import math
circle_radius = 2
def rotate(vertices, angle_degrees, axis=(0,1,0)):
@armindocachada
armindocachada / nginx-ingress-internal-gke.yaml
Last active January 30, 2021 18:54
Yaml to create a second nginx ingress controller in a separate namespace
apiVersion: v1
kind: Namespace
metadata:
name: ingress-nginx-internal
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
---
@armindocachada
armindocachada / .env_template_yeelightweather
Created August 15, 2020 09:21
Yeelight Weather .env file
latitude=<YOUR LATITUDE>
longitude=<YOUR LONGITUDE>
metoffice_client_id=<CLIENT ID>
metoffice_client_secret=<CLIENT SECRET ID>
@armindocachada
armindocachada / Dockerfile_yeelightweather
Last active August 15, 2020 09:12
Docker files for Yeelight weather
FROM python:rc-slim-buster
RUN TZ=Europe/London && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get -y update && apt-get -y install cron
RUN pip3 install yeelight
COPY files/* /home/
#RUN chmod 755 /script.sh /entry.sh
RUN /usr/bin/crontab /home/crontab.txt
# Run the command on container startup
@armindocachada
armindocachada / setupWeatherFlowYeelight.py
Last active August 9, 2020 11:08
Method showing how you can create a lightflow for the Yeelight smart lights using Python
def setupWeatherFlow(bulb,weather,durationFlowSeconds=60):
"""
We use HSV color transitions. In case there is no precipitation, the color will remain static for a minute or two.
If there is precipitation, the light will pulse with varying levels of brightness.
Depending on the temperature the light will be deep red if it is hot or deep blue if it is freezing.
The flow itself will end automatically based on the durationFlowSeconds parameter.
"""
hue = 0
saturation = 100
if weather['temperatureCode'] == "Hot":
def determineWeather():
"""
We call the weather API and get the weather for the next few hours.
The API itself gives way too much information. All I want to know,
what is the minimum and maximum temperature and whether is going
to rain or snow. And whether it is going to be light or heavy.
>>> determineWeather()
{'precipitation': False, 'heavyRain': False, 'heavySnow': False, 'temperatureCode': 'Hot'}
"""
import http.client