Skip to content

Instantly share code, notes, and snippets.

[
{
"fancy":"b(lips)(tick)seed",
"beauty":0.64
},
{
"fancy":"dob(sons)i(est)ivate",
"beauty":0.17284
},
{
[
{
"title": "apples",
"count": [12000, 20000],
"description": {"text": "...", "sensitive": false}
},
{
"title": "oranges",
"count": [17500, null],
"description": {"text": "...", "sensitive": false}
@iloahz
iloahz / gist:5597008
Created May 17, 2013 04:56
v2ex auto coin
class V2exHandler(webapp2.RequestHandler):
def get(self, cmd):
return
if cmd == 'daily':
url = 'http://v2ex.com/signin'
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31'),
('Referer', 'http://v2ex.com/signin')]
res = opener.open(url)
@iloahz
iloahz / gist:5127467
Last active December 14, 2015 18:09
min cost max flow
#include <set>
#include <cmath>
#include <queue>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
@iloahz
iloahz / enlargeByUrl.py
Created December 13, 2012 05:40
try get an image with better quality from any image given by url. uses google's search by image.
import urllib, urllib2
from cookielib import CookieJar
from urlparse import urlparse, parse_qs
from bs4 import BeautifulSoup
def toFile(s):
f = open('dat.html', 'w')
f.write(s)
f.close()
@iloahz
iloahz / sgu131.cpp
Created September 6, 2012 07:58
SGU 131 Hardwood floor by iloahz@Attiix
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 11;
const int MAXS = 1 << 9;
const int d[][2] = {{1, 1}, {3, 0}, {1, 3}, {2, 3}, {3, 1}, {3, 2}};
@iloahz
iloahz / sgu132_maker.cpp
Created September 6, 2012 05:20
Data Maker for SGU 132 Another Chocolate Maniac by iloahz@Attiix
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 71;
const int MAXS = 1 << 7;
int main(){
@iloahz
iloahz / sgu132.cpp
Created September 6, 2012 05:18
SGU 132 Another Chocolate Maniac by iloahz@Attiix
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 72;
const int MAXS = 1 << 7;
int m, n, s;
@iloahz
iloahz / pku2411.cpp
Created September 5, 2012 15:48
POJ 2411 Mondriaan's Dream by iloahz@Attiix
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 12;
const int MAXS = 2048;
int h, w;
@iloahz
iloahz / zoj2563.cpp
Created September 5, 2012 15:29
ZOJ 2563 Long Dominoes by iloahz@Attiix
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 31;
const int MAXS = 512;
int n, m;