Skip to content

Instantly share code, notes, and snippets.

View MaxMorais's full-sized avatar
🏢
Building TechMax Soluções

Maxwell Morais MaxMorais

🏢
Building TechMax Soluções
View GitHub Profile
@ederwander
ederwander / gist:1342497
Created November 6, 2011 05:01
Accessing the Google Speech API + Python
# Copyright (c) 2011, Eng Eder de Souza
# ___ _ _ ___
# | __|__| |___ _ _ __| |___ / __| ___ _ _ _____ _
# | _|/ _` / -_) '_| / _` / -_) \__ \/ _ \ || |_ / _` |
# |___\__,_\___|_| \__,_\___| |___/\___/\_,_/__\__,_|
#Accessing the Google API for speech recognition!
#Open a file type Wav to speech recognition
#This source does not require any external programs to perform audio conversions :-)
#http://ederwander.wordpress.com/2011/11/06/accessing-the-google-speech-api-python/
#Eng Eder de Souza
@lsbardel
lsbardel / async.py
Created May 8, 2012 16:15
A micro-asyncronous script derived from twisted
'''A micro-asyncronous script derived from twisted.'''
import sys
import traceback
from collections import deque
__all__ = ['Deferred', 'MultiDeferred']
def iterdata(stream):
@i8beef
i8beef / Node-Red OAuth2 For Google Actions.md
Last active July 30, 2018 18:37
Google Actions OAuth Flow

OAuth 2 Authorization Code Flow For Use With Google Actions

This flow provides a "fake" OAuth 2 implementation for use with the Google Actions API.

Exposes three endpoints:

  1. /google/oauth-auth - Main auth endpoint that Google will call to initialize an OAuth 2 handshake. Checks "client" and "client secret", and returns a login form.
  2. /google/oauth-login - Processes login form, verifies "auth key" provided and generates a new OAuth auth code that the caller (Google) can then exchange for a real OAuth 2 ticket via the last endpoint.
  3. /google/oauth-token - Allows the caller to exchange an "auth key" for a valid OAuth 2 token, or request a new token via refresh token.

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@livibetter
livibetter / README.md
Last active February 12, 2020 20:48
Tkinter (Tk/Ttk) Progressbar widget example
@JuniorPolegato
JuniorPolegato / calcular_formula.py
Last active May 29, 2020 02:46
Exemplo de script para se calcular qualquer fórmula, exemplo com juros compostos
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import re
# dado um título e lista de listas no formato
# ('<variável>', '<tipo>', '<descricao>', '<fórmula>')
# pede-se qual variável calcular, pede os valores e dá o resultado
# qualquer valor vazio saida da função
from webclient import *
server = "http://myaccount.erpnext.com/server.py"
user = "your user name"
password = "your password"
login()
customer = get_doc("Customer", customer_name)
@glenrobertson
glenrobertson / white_noise_image.py
Created April 3, 2012 00:05
get PIL white noise image
from PIL import Image
def get_white_noise_image(width, height):
pil_map = Image.new("RGBA", (width, height), 255)
random_grid = map(lambda x: (
int(random.random() * 256),
int(random.random() * 256),
int(random.random() * 256)
), [0] * width * height)
pil_map.putdata(random_grid)
import lxml.etree
def pprint(elem):
print lxml.etree.tostring(elem, pretty_print=True)
class Bind(object):
def __init__(self, path, converter=None, first=False):
'''
path -- xpath to select elements
converter -- run result through converter
first -- return only first element instead of a list of elements
@gagarine
gagarine / mysql_multiple_import.bash
Created February 24, 2011 22:34
Import multiple sql file in a mysql database
#!/bin/bash
db=$1
user=$2
passwd=$3
if [ "$db" = "" ]; then
echo "Usage: $0 db_name user password"
exit 1
fi
clear
for sql_file in *.sql; do