Skip to content

Instantly share code, notes, and snippets.

View leotada's full-sized avatar

Leonardo leotada

View GitHub Profile
@nicklegr
nicklegr / bear.coffee
Created April 21, 2012 02:19
enchant.js bear sample in CoffeeScript
enchant()
window.onload = () ->
game = new Game(320, 320)
game.fps = 24
game.preload('chara1.gif')
# The images used in the game should be preloaded
game.onload = () ->
bear = new Sprite(32, 32);
@fmasanori
fmasanori / ChuckJokesPython3.py
Last active September 5, 2023 11:36
Chuck Norris Nerd Jokes
from urllib.request import Request, urlopen
import json
req = Request(
url='https://api.chucknorris.io/jokes/random',
headers={'User-Agent': 'Mozilla/5.0'}
)
resp = urlopen(req).read()
data = json.loads(resp.decode('utf-8'))
@securitytube
securitytube / wlan-ssid-sniffer-python-raw-sockets.py
Created April 2, 2013 14:56
WLAN SSID Sniffer in Python using Raw Sockets
#!/usr/bin/env python
import socket
rawSocket = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(0x0003))
rawSocket.bind(("mon0", 0x0003))
ap_list = set()
while True :
pkt = rawSocket.recvfrom(2048)[0]
if pkt[26] == "\x80" :
if pkt[36:42] not in ap_list and ord(pkt[63]) > 0:
ap_list.add(pkt[36:42])
@zokis
zokis / modulos_ficais.json
Created November 7, 2013 19:41
Json de Municípios com id do IBGE, Módulo Fiscal e Nome separados por estados.
{
"BA": [
{
"modulo": 7.0,
"id_ibge": 2919207,
"nome": "Lauro de Freitas"
},
{
"modulo": 50.0,
"id_ibge": 2921500,
@diyan
diyan / gui_automation_python.md
Last active December 4, 2023 14:48
Desktop GUI automation in Python

Desktop

UI Automation. Desktop. Python

GUI toolkit agnostic

autopy - simple, cross-platform GUI automation toolkit. MIT - https://github.com/msanders/autopy/

  • 432 stars, 102 forks, 2950 monthly downloads at 2015-05-13
  • GUI toolkit agnostic
@fmasanori
fmasanori / QEduAvancada2.py
Last active October 22, 2019 17:11
QEdu exemplo de Busca Avançada: escolas, em funcionamento, sem água, energia e esgoto, mostrando alguns detalhes
#The context of this program is a course of an hour to journalists who know nothing about programming in a lab with Python 3 only.
import urllib.request
import json
def analisa_detalhe(cod):
url = 'http://educacao.dadosabertosbr.com/api/escola/'
resp = urllib.request.urlopen(url+str(cod)).read()
resp = json.loads(resp.decode('utf-8'))
if int(resp['salasExistentes']) > 1:
print ('Salas Existentes:', resp['salasExistentes'])
@zokis
zokis / parcelas.py
Last active August 29, 2015 14:23
calcula parcelas
from decimal import Decimal
from math import floor
def parcelas(valor, n, div=False, primeira=False):
formato = Decimal('0.00')
valor = Decimal(valor)
if div:
parcela = Decimal(floor(valor * 100 / n) / 100)
else:
@dnmodder
dnmodder / fixcontroller.py
Last active March 10, 2024 14:25
This script should no longer be necessary thanks to the latest changes made to the master branch of the xpad [https://github.com/paroj/xpad] driver, please give it a try and report any regressions you find.
#!/usr/bin/env python3
import os
import sys
try:
import usb.core
import usb.util
except ImportError:
@debojyoti
debojyoti / lenovo_ideapad_330_ubuntu.md
Last active October 15, 2023 20:13
Lenovo ideapad 330 (15ARR) ubuntu issues and there solutions

Lenovo ideapad 330 (15ARR) ubuntu issues and their solutions

Issue-1: None of the ubuntu distros are getting installed

Solution: Ubuntu distros lower than 18.10 will not work in this laptop, as minimum kernal version required is 4.18.

So install ubuntu 18.10 / xubuntu 18.10 / lubuntu 18.10 / kubuntu 18.10 in UEFI mode

Issue-2: Wifi is not working

@raysan5
raysan5 / raylib_six_years_of_fun.md
Last active December 4, 2023 12:53
raylib: 6 years of fun

raylib_6years_of_fun

raylib: 6 years of fun

raylib has been in development for more than six years now, it has been an adventure! I decided to resume how it was my personal experience working in this free and open source project for such a long time. Just note that the following article explains raylib from a personal point of view, independently of the technical aspects and focusing on the personal adventure; for technical details on raylib evolution, just check raylib history and raylib changelog.

raylib inceptum

Summer 2012 was ending, I had been working hard on my brand new startup emegeme for about 9 months, developing videogames. I was trying to find my blue-ocean, so, I developed and published two games for Windows Phone platform using the ama