Skip to content

Instantly share code, notes, and snippets.

View lessandro's full-sized avatar

Lessandro Mariano lessandro

View GitHub Profile
8B 4C 24 74 8A C3
8B 4C 24 74 B0 01
@lessandro
lessandro / gist:1793818
Created February 10, 2012 23:00
embedly challenge
# 1
def d(n):
return sum([int(m) for m in str(n)])
i = 1
n = 1
while True:
n *= i
@lessandro
lessandro / color.c
Created February 25, 2012 04:35
my (WINNING!) entry for the proggit quiz challenge #9
// http://proggitquiz.com/challenge/9/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
char **grid;
int x, y, n;
void alloc_grid()
@lessandro
lessandro / gist:1907160
Created February 25, 2012 07:06
cz_prob1 @ spoj
#include <iostream>
#include <vector>
using namespace std;
int sp2[] = {2,5,13,17,29,37,41,53,61,73,89,97,101,109,113,137,149,157,173,181,193,197,229,233,241,257,269,277,281,293,313,317,337,349,353,373,389,397,401,409,421,433,449,457,461,509,521,541,557,569,577,593,601,613,617,641,653,661,673,677,701,709,733,757,761,769,773,797,809,821,829,853,857,877,881,929,937,941,953,977,997,1009,1013,1021,1033,1049,1061,1069,1093,1097,1109,1117,1129,1153,1181,1193,1201,1213,1217,1229,1237,1249,1277,1289,1297,1301,1321,1361,1373,1381,1409,1429,1433,1453,1481,1489,1493,1549,1553,1597,1601,1609,1613,1621,1637,1657,1669,1693,1697,1709,1721,1733,1741,1753,1777,1789,1801,1861,1873,1877,1889,1901,1913,1933,1949,1973,1993,1997,2017,2029,2053,2069,2081,2089,2113,2129,2137,2141,2153,2161,2213,2221,2237,2269,2273,2281,2293,2297,2309,2333,2341,2357,2377,2381,2389,2393,2417,2437,2441,2473,2477,2521,2549,2557,2593,2609,2617,2621,2633,2657,2677,2689,2693,2713,2729,2741,2749,2753,2777,2789,2797,2801,2833,2837,2857,2861,2897,2909,2917,
@lessandro
lessandro / gist:1907198
Created February 25, 2012 07:18
hangover @ spoj
#include <iostream>
using namespace std;
int main()
{
double f;
for (;;) {
cin >> f;
if (f == 0.00) break;
@lessandro
lessandro / bb.py
Created March 5, 2012 15:49
Extrato detalhado do site do BB. Retorna uma lista de tuplas (day, description, detail, amount)
# author: Lessandro Z. Mariano
# https://gist.github.com/1978928
import decimal
import lxml.html
import re
import requests
ag = raw_input('agencia (formato 0000-0): ')
cc = raw_input('conta (formato 00000-0): ')
@lessandro
lessandro / gist:2324048
Created April 6, 2012 23:44
Yet another DCPU16 assembler
#include <stdio.h>
#include <string.h>
unsigned short out[100], *curr, *next;
const char *regs[] = {
"a", "b", "c", "x",
"y", "z", "i", "j"
};
@lessandro
lessandro / gist:2399422
Created April 16, 2012 15:21 — forked from dforsyth/gist:2392783
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@lessandro
lessandro / hack.sh
Created April 16, 2012 15:21 — forked from dforsyth/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@lessandro
lessandro / gist:2425452
Created April 20, 2012 02:43
puzzle #1. <algorithm> is just awesome.
#include <algorithm>
#include <cstdio>
#include <cstring>
#define BUFSIZE (sizeof("aa/bb/cccc"))
using namespace std;
bool leap(int year)
{