Skip to content

Instantly share code, notes, and snippets.

View danilo-s-coelho's full-sized avatar

Danilo S. Coelho danilo-s-coelho

View GitHub Profile
@danilo-s-coelho
danilo-s-coelho / mysql-pandas-import.py
Created August 23, 2018 00:19 — forked from stefanthoss/mysql-pandas-import.py
Import data from a MySQL database table into a Pandas DataFrame using the pymysql package.
import pandas as pd
import pymysql
from sqlalchemy import create_engine
engine = create_engine('mysql+pymysql://<user>:<password>@<host>[:<port>]/<dbname>')
df = pd.read_sql_query('SELECT * FROM table', engine)
df.head()
@danilo-s-coelho
danilo-s-coelho / blob-util.min.js
Created October 27, 2017 16:39 — forked from nolanlawson/blob-util.min.js
Read img tag, store it as a blob, then read it as a blob
!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.blobUtil=e():"undefined"!=typeof global?global.blobUtil=e():"undefined"!=typeof self&&(self.blobUtil=e())}(function(){return function e(t,n,r){function o(u,a){if(!n[u]){if(!t[u]){var s="function"==typeof require&&require;if(!a&&s)return s(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var f=n[u]={exports:{}};t[u][0].call(f.exports,function(e){var n=t[u][1][e];return o(n?n:e)},f,f.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t){"use strict";function n(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=-1;++o<t;)r[o]=e.charCodeAt(o);return n}function r(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,o=-1;++o<r;)t+=String.fromCharCode(n[o]);return t}function o(e,t){return new L(function(n,r){var o=new Image;t&&(o.crossOrigin=t),o.onload=function(
@danilo-s-coelho
danilo-s-coelho / proxy.js
Created July 28, 2017 20:32 — forked from robin/proxy.js
A reverse-proxy for CouchDB written in Node.js
#!/usr/local/bin/node
var sys = require('sys');
var http = require('http');
var url = require('url');
var PREFIX = '/db/';
var TARGET = 'http://example.cloudant.com';
var PORT = 8001;
@danilo-s-coelho
danilo-s-coelho / top_movies.sql
Last active February 26, 2020 05:51 — forked from pamelafox/top_movies.sql
Top 100 Movies
/* Source: http://www.boxofficemojo.com/alltime/world/ */
CREATE TABLE top_movies(
rank INTEGER NOT NULL PRIMARY KEY,
title TEXT,
studio TEXT,
worldwide REAL,
domestic_money REAL,
domestic_percent REAL,
overseas_money REAL,