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
  • 03:34 (UTC -03:00)
  • X @marioidival
View GitHub Profile
class Batman
def detective?
true
end
def looking_at_sign
false
end
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
upstream protest {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a single worker for timing out).
server unix:/tmp/protest.socket fail_timeout=0;
}
server {
listen 80 default;
server_name protest;
@marioidival
marioidival / gist:5388964
Last active December 16, 2015 06:09
Tweets for my love
from time import sleep
import tweepy
consumer_key= ""
consumer_secret= ""
access_token= ""
access_token_secret= ""
import re
def validator(files):
pattern = {1: r'',2:r'',3: r'', 4: r'',5: r'',6: r'',7: r'',8: r'',9: r'',10: r'',11: r''}
filex = open(files)
gen_files = (lists in for lists in filex.readlines())
for gen_list in gen_files:
one_list = gen_list.split(";")
import os
import shutil
import itertools
import pyinotify
DIR_VERIFY = '/var/log/'
DIR_DESTINY = '/home/suporte/'
def get_root(find_file):
for root, direc, files in os.walk(DIR_VERIFY):
def dict_except(func, excp, dici, key):
try:
rv = func()
return rv
except excp as e:
if key in dici:
dici[n] += "-- %s" % str(e)
@marioidival
marioidival / model.py
Last active December 20, 2015 15:39
How to serializer FK :)
from django.db import models
class PersonManager(models.Manager):
def get_by_natural_key(self, first_name, last_name):
return self.get(first_name=first_name, last_name=last_name)
class Person(models.Model):
objects = PersonManager()
first_name = models.CharField(max_length=100)
"""
Aqui, temos uma Classe Pessoa, onde ela espera receber um nome e sobrenome
quando for iniciada
"""
class Pessoa(object):
def __init__(self, nome, sobrenome):
self.nome = nome
self.sobrenome = sobrenome
set nocompatible
filetype off
syntax on
set number
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
let mapleader = ","
" let Vundle manage Vundle