Skip to content

Instantly share code, notes, and snippets.

View AndersonFirmino's full-sized avatar
🐍
📜 🎼 🎮 🐧 🦆

Anderson Araujo AndersonFirmino

🐍
📜 🎼 🎮 🐧 🦆
View GitHub Profile
@AndersonFirmino
AndersonFirmino / filedownloader.js
Created July 11, 2016 19:40 — forked from DavidMah/filedownloader.js
File Download requests using jquery/POST request with psuedo ajax
// Takes a URL, param name, and data string
// Sends to the server.. The server can respond with binary data to download
jQuery.download = function(url, key, data){
// Build a form
var form = $('<form></form>').attr('action', url).attr('method', 'post');
// Add the one key/value
form.append($("<input></input>").attr('type', 'hidden').attr('name', key).attr('value', data));
//send request
form.appendTo('body').submit().remove();
@AndersonFirmino
AndersonFirmino / template.sh
Created July 12, 2016 17:14
Template for ShellScripts
#!/bin/bash
# ------------------------------------------------------------------
# [Author] Title
# Description
#
# This script uses shFlags -- Advanced command-line flag
# library for Unix shell scripts.
# http://code.google.com/p/shflags/
#
# Dependency:
@AndersonFirmino
AndersonFirmino / snake.py
Created August 11, 2016 03:37 — forked from sanchitgangwar/snake.py
Snakes Game using Python
# SNAKES GAME
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
curses.initscr()
win = curses.newwin(20, 60, 0, 0)
@AndersonFirmino
AndersonFirmino / multit.py
Created August 18, 2016 03:42 — forked from d4rkcat/multit.py
multithread linux commands
#!/usr/bin/env python
# Multi-threading template
import argparse, subprocess, signal, Queue
from threading import Thread, Lock
from sys import stdout
from os import getpid, kill
class myThread (Thread):
def __init__(self, threadID, name, q):
@AndersonFirmino
AndersonFirmino / python-logo-ascii.txt
Last active December 16, 2016 18:54
python logo ascii art
..:77I777777777777777777777I. .
..?77777777777777777777777777777$+..
. ~7777777I7777777777777777777777777$~..
.7I7777...7777777777777777777777777$7+.
.?7777.. ..77777777777777777777777$$7.
.77777 777777777777777777777$$$$$I
.77777.. ...7777777777777777777$$$$$$$$
.7777777 .77$777777777777777777$$$$$$$$
.77777777777777777777777777777$$$$$$$$$$
.77777777777777777777777777$$$$$$$$$$$$$
@AndersonFirmino
AndersonFirmino / MongoEngineGridFS Server
Created October 13, 2016 17:58 — forked from kimenye/MongoEngineGridFS Server
Serve GridFs files from mongo engine with flask
from flask import Flask, request, redirect, url_for, make_response, abort
from mongoengine.fields import get_db
from bson import ObjectId
from gridfs import GridFS
from gridfs.errors import NoFile
from <your_app> import app
@app.route('/files/<oid>')
def serve_gridfs_file(oid):
try:
@AndersonFirmino
AndersonFirmino / flask_gridfs_server.py
Created October 13, 2016 18:07
A simple GridFS server built with Flask
from flask import Flask, request, redirect, url_for, make_response, abort
from werkzeug import secure_filename
from pymongo import MongoClient
from bson.objectid import ObjectId
from gridfs import GridFS
from gridfs.errors import NoFile
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
@AndersonFirmino
AndersonFirmino / database_merge.py
Created October 25, 2016 13:56
Script para merge de files sql
# coding=utf-8
#########################################################
# Script para pegar varios arquivos sql em um diretorio
# e mesclar todos em um unico arquivo.
# by: Anderson Firmino (coderpy) <[email protected]>
# by: Gustavo Rodrigo (hpix) <[email protected]>
#########################################################
import os
@AndersonFirmino
AndersonFirmino / ui.datepicker-pt-BR.js
Created October 30, 2016 23:09 — forked from Senhordim/ui.datepicker-pt-BR.js
Tradução datepicker pt-BR
/* Brazilian initialisation for the jQuery UI date picker plugin. */
/* Written by Leonildo Costa Silva ([email protected]). */
jQuery(function($){
$.datepicker.regional['pt-BR'] = {
closeText: 'Fechar',
prevText: '&#x3c;Anterior',
nextText: 'Pr&oacute;ximo&#x3e;',
currentText: 'Hoje',
monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho',
'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
@AndersonFirmino
AndersonFirmino / email_example.py
Created November 1, 2016 14:58
Exemplo de envio de email com conteudo html usando python
#!/usr/bin/env python3
# retirado da pagina https://docs.python.org/3/library/email-examples.html#email-examples
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# me == my email address
# you == recipient's email address
me = "[email protected]"