Skip to content

Instantly share code, notes, and snippets.

@biazzotto
biazzotto / starwars.py
Created July 5, 2016 01:44 — forked from stestagg/starwars.py
micropython starwars
import gc
import machine
import pyb
import time
import network
# Configure GPIO pins 0 and 2 to be used for
# the I²C interface
iic = machine.I2C(pyb.Pin(2), pyb.Pin(0))
@biazzotto
biazzotto / Pense-Bem-Songs.pde
Created July 22, 2016 14:13 — forked from thiagoalz/Pense-Bem-Songs.pde
Arduino file to play Pense-Bem songs
/*
Welcome: 'egage',
GameSelected: 'CgC',
Correct: 'gCC',
Wrong: 'ec',
Fail: 'egec',
Winner: 'gggeCCC',
HighBeep: 'C',
LowBeep: 'c'
@biazzotto
biazzotto / gist:3fe82a7a8f3fa88c0011e4d423ec594b
Created September 15, 2017 12:41 — forked from marcelograciolli/gist:902018b4464d4c1cc29d
Como criar uma assinatura de e-mail HTML - Graciolli Dotcom
<style type="text/css">
TD {margin: 0px;padding: 0px;}
IMG {margin: 0px;padding: 0px;}
A.headline {TEXT-DECORATION: none;margin:;}
A.headline:link {TEXT-DECORATION: none;}
A.headline:visited {TEXT-DECORATION: none}
A.headline:hover {TEXT-DECORATION: underline;}
A: {margin: 0px;padding: 0px;}
</style>
@biazzotto
biazzotto / python-telegram-api-is-started.py
Created June 27, 2018 13:31 — forked from voider1/python-telegram-api-is-started.py
A decorator for python-telegram-bot API, makes sure a command is only executed when the bot's state is started!
from functools import wraps
from telegram.ext import Updater, CommandHandler
# Using a factory function (closures) to contain the started-state of the bot
# This is cleaner and better-practice than using globals
def state_factory():
"""Factory function for containing the bot state."""
state = False
@biazzotto
biazzotto / install_font_adobe_source_code_pro.sh
Created June 28, 2018 18:05 — forked from enzinier/install_font_adobe_source_code_pro.sh
Install font Adobe Source Code Pro on Ubuntu 16.04 LTS
#!/bin/sh
# Userland mode (~$USER/), (~/).
# ~/.fonts is now deprecated and that
#FONT_HOME=~/.fonts
# ~/.local/share/fonts should be used instead
FONT_HOME=~/.local/share/fonts
echo "installing fonts at $PWD to $FONT_HOME"
mkdir -p "$FONT_HOME/adobe-fonts/source-code-pro"
@biazzotto
biazzotto / rot.py
Created August 28, 2018 18:40 — forked from cincodenada/rot.py
Quick binary rotation (rotl/rotr) in Python
def rotl(num, bits):
bit = num & (1 << (bits-1))
num <<= 1
if(bit):
num |= 1
num &= (2**bits-1)
return num
def rotr(num, bits):
@biazzotto
biazzotto / esp32-oled-demo.py
Created September 7, 2018 17:35 — forked from laurivosandi/esp32-oled-demo.py
OLED screen demo on ESP32 with MicroPython
# Pull the SDD1306 lib from here https://github.com/adafruit/micropython-adafruit-ssd1306/blob/master/ssd1306.py
from time import sleep_ms
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
buf = "wubba lubba dub dub "
i2c = I2C(-1, Pin(4),Pin(5),freq=40000) # Bitbanged I2C bus
assert 60 in i2c.scan(), "No OLED display detected!"
@biazzotto
biazzotto / HowToOTG.md
Created June 15, 2019 15:46 — forked from gbaman/HowToOTG.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@biazzotto
biazzotto / HowToOTGFast.md
Created June 15, 2019 15:53 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

###Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)
More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH is

Working commands 55PUS7181
http://192.168.3.51:1925/system
{"menulanguage":"Dutch","name":"55PUS7181\/12","country":"Netherlands","serialnumber_encrypted":"F6905Z+vyquNhZoXegQ1DzZXCqMIcjJpkzy3LsiPac=\n","softwareversion_encrypted":"1YWR42sjQ6xdjuyIXWZbyPnoRswLoRswLmKtAhR9GRsBx1qY=\n","model_encrypted":"jGNvXDerdJoWjOpwh\/n0gw2MgM7oRswLoRswLKC73wfMgra3S62c4=\n","deviceid_encrypted":"7mv3ZEtMH8oRswL0RoRswLISTn38FN8HAqfmSF95qoaiRsuukSraQ=\n","nettvversion":"6.0.2","epgsource":"one","api_version":{"Major":6,"Minor":2,"Patch":0},"featuring":{"jsonfeatures":{"editfavorites":["TVChannels","SatChannels"],"recordings":["List","Schedule","Manage"],"ambilight":["LoungeLight","Hue","Ambilight"],"menuitems":["Setup_Menu"],"textentry":["context_based","initial_string_available","editor_info_available"],"applications":["TV_Apps","TV_Games","TV_Settings"],"pointer":["not_available"],"inputkey":["key"],"activities":["intent"],"channels":["preset_string"],"mappings":["server_mapping"]},"systemfeatures":{"tvtype":"consumer","