Skip to content

Instantly share code, notes, and snippets.

View carlopires's full-sized avatar

Carlo Pires carlopires

  • Aldeia Global
  • Goiânia/Brazil
View GitHub Profile
@carlopires
carlopires / fetch_memberships.py
Created July 28, 2016 15:38
Google API with eventlet - memberships download example
import eventlet
eventlet.patcher.monkey_patch(select=True, socket=True)
import json
import time
import codecs
import httplib2
import logging
logging.basicConfig(level=logging.DEBUG)
@carlopires
carlopires / main.py
Created April 30, 2016 19:50
Python argparse boilerplate
"""
@author: Carlo Pires <[email protected]>
"""
import argparse
class Commands(object):
def status(self, args):
print('status for {}'.format(args.module))
"""
@author: Carlo Pires <[email protected]>
To generate the certificate with openssl:
openssl genrsa 2048 > o365app.key
openssl req -new -x509 -nodes -sha512 -days 365 -key o365app.key > o365app.crt
To generate key credentials for MS Azure:
python gen_key_credentials.py o365app.crt
"""
@carlopires
carlopires / webshims-test2.html
Created October 24, 2013 12:20
Webshims test for email, date and number (take 2)
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>HTML5 date test</title>
<meta name="description" content="HTML5 date test with Bootstrap 3 and webshims">
@carlopires
carlopires / webshims-test1.html
Created October 24, 2013 12:11
Webshims test for email, date and number (take 1)
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>HTML5 date test</title>
<meta name="description" content="HTML5 date test with Bootstrap 3 and webshims">
@carlopires
carlopires / demo_oci_parameters.php
Created February 25, 2013 20:57
Demo of PHP OCI with parameters
<?php
$ORACLE_HOST = "127.0.0.1";
$ORACLE_PORT = "1521";
$ORACLE_SID = "mysid";
$ORACLE_USER = "myuser";
$ORACLE_PASSWORD = "mypass";
$ORACLE_DSN = "
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = $ORACLE_HOST)(PORT = $ORACLE_PORT))
@carlopires
carlopires / demo_oci.php
Created February 25, 2013 20:52
Demo of using PHP OCI in a Oracle server
<?php
$ORACLE_HOST = "127.0.0.1";
$ORACLE_PORT = "1521";
$ORACLE_SID = "mysid";
$ORACLE_USER = "myuser";
$ORACLE_PASSWORD = "mypass";
$ORACLE_DSN = "
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = $ORACLE_HOST)(PORT = $ORACLE_PORT))
@carlopires
carlopires / bootstrap-plugins.txt
Created January 18, 2012 12:30 — forked from mklabs/bootstrap-plugins.txt
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js
@carlopires
carlopires / index-text-with-redis.py
Created December 16, 2011 17:42
Indexing Redis with Python
# -*- coding: utf-8 -*-
"""
Created on 16/12/2011
@author: Carlo Pires <[email protected]>
"""
import json
from redis import Redis
r = Redis()
@carlopires
carlopires / redis_session_store.py
Created December 9, 2011 15:22
Werkzeug Redis Session Store
# -*- coding: utf-8 -*-
"""
Created on 09/11/2011
@author: Carlo Pires <[email protected]>
"""
import tnetstring
from werkzeug.contrib.sessions import SessionStore
SESSION_TIMEOUT = 60*60*24*7 # 7 weeks in seconds