Skip to content

Instantly share code, notes, and snippets.

View marioidival's full-sized avatar
😶‍🌫️

Mario Idival marioidival

😶‍🌫️
  • Self Employed ;)
  • Campina Grande, Paraíba, Brazil
  • 09:54 (UTC -03:00)
  • X @marioidival
View GitHub Profile
import unittest
from pyramid import testing
from paste.deploy.loadwsgi import appconfig
from webtest import TestApp
from mock import Mock
from sqlalchemy import engine_from_config
from sqlalchemy.orm import sessionmaker
from app.db import Session
# Update System
sudo apt-get update && sudo apt-get dist-upgrade
# Install prerequisites
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6 libreadline6-dev libncurses5-dev zlib1g zlib1g-dev sqlite3 libxslt-dev libxml2-dev libsqlite3-dev python-software-properties postfix curl libcurl3 libcurl3-gnutls libcurl4-openssl-dev
# Misc Utilities
sudo apt-get install ssh tmux vim git-core wget zip unzip mcrypt imagemagick libmagickwand-dev htop whois dnsutils powertop gparted zenmap terminator
# Set up git config
@marioidival
marioidival / mommy.py
Created May 10, 2015 18:04
Mother's Day
# -*- coding: utf-8 -*-
from time import sleep
from random import choice
import tweepy
# The consumer keys can be found on your application's Details
# page located at https://dev.twitter.com/apps (under "OAuth settings")
CONSUMER_KEY = ""
"""
=========================================================
Classe ObjetoJS: imitação simples de um objeto JavaScript
=========================================================
Uma instância é construída passando argumentos nomeados:
>>> o = ObjetoJS(z=33, x=11, y=22)
A representação textual de uma instância parece a chamada do
package main
import (
"fmt"
"bytes"
"math/rand"
"time"
)

Porting an Existing Application to Pyramid

Porting an application across platforms is never particularly easy, nor very interesting. In fact, it's usually a terrible idea: in general, if it ain't broke, don't fix it. But sometimes you have to do it. Maybe a new platform has a feature you believe you can't live without, or the project scope is expanding in directions that make you feel like your original platform choice might not have been the best, or maybe it's just necessary to port for political reasons. Whatever.

from zope import interface
from zope import component
class ISocket(interface.Interface):
pins = interface.Attribute("""pins of socket""")
class ISocket2(ISocket):
def connect_socket_2_pins():
@marioidival
marioidival / zcadbz.py
Created August 16, 2015 14:47
Attempt Implementation - Dragon Ball with ZCA (Zope Component Architecture)
from zope.interface import Interface, Attribute, implementer
from zope.component import adapts, getGlobalSiteManager
class ICharacter(Interface):
name = Attribute("""Name of character""")
race = Attribute("""Race of character""")
ki = Attribute("""Ki of character""")