Skip to content

Instantly share code, notes, and snippets.

# Function to generate a truth table (number of variables of the table (fixed number), number of variables of the table (recursive))
def geraTabelaVerdade(m,n,tabelaVerdade):
bits=2**m # rows in the table, fixed value
repeticoes_coluna=(bits//(2**n))*2
repeticoes_linha=(2**n//2)//2
contador=0
if not tabelaVerdade: # Create the first column
for i in range(bits // 2):
tabelaVerdade.append('0')
for i in range(bits // 2):
@LeeJunNakao
LeeJunNakao / Free_Textbooks.md
Created April 7, 2020 22:03 — forked from lucasbf/Free_Textbooks.md
Lista de livros liberados gratuitamente para download por diversas editoras.

Livros Gratuitos em Computação

Em tempos de COVID-19 algumas editoras liberaram uma série de livros do seu acervo em formato ebook para download. Entre elas a SpringerNature disponibilizou ebooks em diversas áreas do conhecimento, a lista completa pode ser vista aqui.

Entretanto, uma seleção foi realizada na lista geral e contempla os principais títulos para a área da Ciência da Computação e Análise e Desenvolvimento de Sistemas. São 60 livros que estão divididos em Matemática e Teoria da Computação, Programação e Desenvolvimento de Software, Ciência de Dados e Aprendizado de Máquina, e por fim Diversos.

O nível Básico ou Avançado é indicado em cada livro.

Qualquer dúvida e/ou sugestão de correção deixe um comentário ao final do gist, ou me encontre em @lucasfigueira.

import ntptime
import network
import time
import machine
import utime
import gc
import urequests
import lvgl as lv
import lvesp32
import ILI9341 as ili
@Ircama
Ircama / LgMagicRemoteKeys.md
Last active September 6, 2025 21:21
Replacing Netflix and Amazon keys of the webOS LG TV LG Magic Remote with other apps

Replacing Netflix and Amazon keys of the webOS LG TV LG Magic Remote with other apps

This procedure allows substituting one or both Netflix and Amazon keys of the Magic Remote Control Unit with other apps or TV control menus of the webOS LG TV.

Netflix and Amazon keys can be found just over the Red-Green-Yellow-Blue color buttons of such remote.

Assumption for this procedure is that you accept to uninstall the apps related to the keys to be substituted. Example: if you want to replace the Netflix key, you need to uninstall Netflix (possibly, you are not using Netflix if you do not need such key).

To uninstall Netflix or Amazon Prime, press the Home key of the Magic Remote, select the "LG Content Store" app, press "APP" at the top of the screen, press "My Apps", press the "Rem

@manuelbl
manuelbl / README.md
Created August 3, 2019 09:12
ESP32 as Bluetooth Keyboard

ESP32 as Bluetooth Keyboard

With its built-in Bluetooth capabilities, the ESP32 can act as a Bluetooth keyboard. The below code is a minimal example of how to achieve it. It will generate the key strokes for a message whenever a button attached to the ESP32 is pressed.

For the example setup, a momentary button should be connected to pin 2 and to ground. Pin 2 will be configured as an input with pull-up.

In order to receive the message, add the ESP32 as a Bluetooth keyboard of your computer or mobile phone:

  1. Go to your computers/phones settings
  2. Ensure Bluetooth is turned on
#!/usr/bin/env python
import sys, os, time
import tweepy
keys = dict(
consumer_key='_YOUR_CONSUMER_KEY',
consumer_secret='_YOUR_SECRET_KEY',
access_token='_YOUR_ACCESS_TOKEN',
access_token_secret='_YOUR_ACCESS_TOKEN_SECRET'
)
@villares
villares / py_lotusrosettes.pyde
Last active July 2, 2023 11:38
Lotus Rosettes for Processing Python Mode
"""
Under Creative Commons License
https:#creativecommons.org/licenses/by-sa/4.0/
Ported for Processing Python Mode py.processing.org <- for Processing IDE
by Alexandre Villares abav.lugaralgum.com, 9-Oct-2018
Based upon code for p5js.org at https://jcponce.github.io/misc/lotusrosettes.html
by Juan Carlos Ponce Campuzano, 9-Oct-2018
Based upon Dan Anderson's code
https:#www.openprocessing.org/sketch/519299
"""
@Hodes
Hodes / safesign.md
Last active March 3, 2020 16:50 — forked from jonasmalacofilho/safesign.md
Instalando o SafeSign Crypto USB Token no Firefox/Linux

How to exploit vulnerable implementations

  • Doesn't validate signature? → Forge arbitrary JWTs
  • Acts on data in payload before validating signature? → Forge arbitrary JWTs
  • Doesn't validate signature algorithm? → Forge JWT with algorithm "none"
  • Doesn't validate key↔algorithm match? → Create HS256 signature signed with expected public key
  • Doesn't validate audience? → Trick victim to sign in to evil app, then use creds to auth to vulnerable app as victim
  • Doesn't validate issuer? → Use JWT for one tenant to authenticate to a different tenant
  • Doesn't validate nonce? → Replay attack
  • Doesn't validate nonce/state against original sent value? → CSRF
@marcoscastro
marcoscastro / bitcoin.py
Last active October 20, 2020 11:38
Python - Obtendo o preço do bitcoin
from urllib.request import Request, urlopen
import json, time
def obter_valor():
url = "http://api.coindesk.com/v1/bpi/currentprice.json"
req = Request(url, headers={'User-Agent': 'Mozilla/5.0'})
response = urlopen(req).read()
data = json.loads(response.decode('utf-8'))
valor = float(data['bpi']['USD']['rate'].replace(',', ''))
return valor