Skip to content

Instantly share code, notes, and snippets.

View maiconschmitz's full-sized avatar
:octocat:

Maicon Schmitz maiconschmitz

:octocat:
View GitHub Profile
@gka
gka / sqlite3-example.py
Last active June 4, 2023 01:32
The code below does the same as the example snippet you've just seen: opening a database connection, creating a new table with some columns, storing some data, altering the table schema and adding another row.
import sqlite3
# open connection and get a cursor
conn = sqlite3.connect(':memory:')
c = conn.cursor()
# create schema for a new table
c.execute('CREATE TABLE IF NOT EXISTS sometable (name, age INTEGER)')
conn.commit()
@matbor
matbor / mqttitudeTOmysql.py
Last active September 3, 2022 13:32
Simple Python script (v2.7x) that subscribes to a MQTT broker topic and inserts the data into a mysql database for later querying. This is designed to be used with the http://mqttitude.org/
#!/usr/bin/env python
# September 2013
# by Matthew Bordignon, @bordignon on Twitter
#
# Simple Python script (v2.7x) that subscribes to a MQTT broker topic and inserts the topic into a mysql database
# This is designed for the http://mqttitude.org/ project backend
#
import MySQLdb
import mosquitto
/*
TITLE: CODE GRABBER FOR HT6P20B ENCODER
CREATED BY: AFONSO CELSO TURCATO
DATE: 14/JAN/2014
E-MAIL: acturcato (at) gmail.com
LICENSE: GPL
REV.: 00
DESCRIÇÃO:
http://acturcato.wordpress.com/2014/01/14/clonagem-de-controle-remoto-rf-learning-code-ht6p20b-com-arduino/
@wangyingang
wangyingang / get_gravatar.md
Last active May 10, 2017 16:41
Get gravatar image using command line(Mac OS X only)

#Get Gravatar image using command line(Mac OS X only)

Gravatar image download url

http://www.gravatar.com/avatar/HASH

Get default image

curl -o yourname.png http://www.gravatar.com/avatar/$(md5 -q -s youremail@example.com)
@alanhoff
alanhoff / email.js
Last active May 17, 2021 22:50
Enviando e-mails usando Node.js e o nodemailer
// Enviando e-mails usando o Node.js e o famoso nodemailer
var nodemailer = require('nodemailer');
// Vamos criar a conta que irá mandar os e-mails
var conta = nodemailer.createTransport({
service: 'Gmail', // Existem outros services, você pode procurar
// na documentação do nodemailer como utilizar
// os outros serviços
auth: {
user: 'seuemail@gmail.com', // Seu usuário no Gmail
@benkulbertis
benkulbertis / cloudflare-update-record.sh
Last active July 24, 2024 10:20
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
Salva isso como mp3
http://www.receita.fazenda.gov.br/pessoajuridica/cnpj/cnpjreva/captcha/gerarSom.asp
Converte pra flac
http://stackoverflow.com/questions/18266785/sox-for-converting-flac-file-to-320-bit-mp3
sox input.mp3 output.flac
Envia para google speech e recebe um json
require 'json'
require 'net/http'
@gbaman
gbaman / HowToOTG.md
Last active July 19, 2024 11:47
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

import sys
def count_words(text_file):
file = open(textfile,'r+')
word_list = {}
for word in file.read().split():
if word not in word_list:
word_list[word] = 1
else:
@andresmachado
andresmachado / import_banks.py
Created April 17, 2017 02:23
Import all active banks in Brazil
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 5 15:50:49 2017
@author: andre
"""
import json
from bs4 import BeautifulSoup