Skip to content

Instantly share code, notes, and snippets.

View diegotoral's full-sized avatar

Diego Toral diegotoral

View GitHub Profile

Keybase proof

I hereby claim:

  • I am diegotoral on github.
  • I am diegotoral (https://keybase.io/diegotoral) on keybase.
  • I have a public key ASCkzy31yRtkMM2Sx-RxsI51TRikrlEmqEJJNDSaYp3sHQo

To claim this, I am signing this object:

--regex-ruby=/^[ \t]*describe ['"](.*)['"] do/\1/d,rspec describe/
--regex-ruby=/^[ \t]*context ['"](.*)['"] do/\1/C,rspec context/
--regex-ruby=/^[ \t]*it ['"](.*)['"] do/\1/i,rspec tests/
@diegotoral
diegotoral / signal.py
Created November 11, 2013 02:36
A simple signal class for Python.
class Signal(object):
"""
Signal class.
"""
def __init__(self, sender):
super(Signal, self).__init__()
self.sender = sender
self.listeners = []
def connect(self, callback):
@diegotoral
diegotoral / .bashrc
Last active December 16, 2015 11:29
Personalized .bashrc file. Shows current branch for git repositories
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
@diegotoral
diegotoral / s_sum.c
Last active December 15, 2015 13:59
Seja S uma sequência cujos valores iniciais são {1,1,2,4,3,9,4,16,5,...}. Escreva um programa que, dado um número n (lido da entrada padrão), envia para a saída padrão a soma nos n primeiros números da sequência S.
#include <stdio.h>
int s (int x)
{
if (x == 0)
return 0;
else if (x == 1)
return 1;
else
return x * x;
@diegotoral
diegotoral / birthdays-crawler.py
Created March 18, 2013 16:16
A simple python crawler.
import requests
from bs4 import BeautifulSoup
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/<string:month>/<int:day>')
def birthdays(month, day):
birthdays_html = requests.get('http://www.historyorb.com/birthdays/%s/%d' % (month, day))
#include <stdio.h>
// Arestas/Alfabeto
enum Arestas
{
A, B, C, D, E,
10c, 50c, 100c
}
//Estados do automato
@diegotoral
diegotoral / for.c
Created March 8, 2013 16:43
Never ends!
#include <stdio.h>
int main()
{
for( ; 1; )
printf("Funcionaaa!!!!\n");
return 0;
}
#!/usr/bin/python
import PPMaze
from gi.repository import GObject
from gi.repository import Clutter
class PPGuy(Clutter.Actor):
"""PPGuy class - base class for some entities of the game"""
@diegotoral
diegotoral / gmenu.js
Created June 2, 2012 21:00
GMenu and Applcation example
#!/usr/bin/gjs
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const App = new Lang.Class ({
Name : "App",