Skip to content

Instantly share code, notes, and snippets.

View AlexandreProenca's full-sized avatar
:octocat:
Focusing

Alexandre Proença AlexandreProenca

:octocat:
Focusing
View GitHub Profile
@AlexandreProenca
AlexandreProenca / fastapi_websocket_redis_pubsub.py
Created December 17, 2021 13:54 — forked from timhughes/fastapi_websocket_redis_pubsub.py
FastAPI Websocket Bidirectional Redis PubSub
"""
Usage:
Make sure that redis is running on localhost (or adjust the url)
Install uvicorn or some other asgi server https://asgi.readthedocs.io/en/latest/implementations.html
pip install -u uvicorn
Install dependencies
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel>
<title>G1 > Loterias</title>
<link>http://g1.globo.com/loterias/index.html</link>
<description>
Veja no G1 Loterias os resultados dos últimos concursos da Mega-Sena, Dupla Sena, Loteria Federal, Loteca, Lotofacil, Lotogol, Lotomania, Quina e Timemania.
</description>
<language>pt-BR</language>
<copyright>© Copyright Globo Comunicação e Participações S.A.</copyright>
<atom:link href="http://pox.globo.com/rss/g1/loterias/" rel="self" type="application/rss+xml"/>
@AlexandreProenca
AlexandreProenca / DHT.py
Created August 15, 2018 02:16 — forked from eyllanesc/DHT.py
Raspberry Pi Course Code
import Adafruit_DHT
import time
isRunning = True
while isRunning:
try:
humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT11, 4)
if humidity is not None and temperature is not None:
print('Temp={0:0.1f}* Humidity={1:0.1f}%'.format(temperature, humidity))
else:

Checkout a new working branch

 git checkout -b <branchname>

Make Changes

 git add
 git commit -m "description of changes"

Sync with remote

@AlexandreProenca
AlexandreProenca / README.md
Created January 31, 2017 13:15 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@AlexandreProenca
AlexandreProenca / bottle-cors.py
Created June 30, 2016 17:27 — forked from richard-flosi/bottle-cors.py
Bottle with Cross-origin resource sharing (CORS)
"""
Example of setting up CORS with Bottle.py.
"""
from bottle import Bottle, request, response, run
app = Bottle()
@app.hook('after_request')
def enable_cors():
"""
  • Update HISTORY.rst
  • Update version number in my_project/__init__.py
  • Update version number in setup.py
  • Install the package again for local development, but with the new version number:
python setup.py develop
  • Run the tests:
python setup.py test