This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import quote | |
import urllib3 | |
from lxml import etree | |
http = urllib3.PoolManager() | |
def getFriends(uname): | |
r = http.request('GET', 'http://juick.com/%s/friends' % quote(uname)) | |
t = etree.HTML(r.data) | |
friends = t.xpath('/html/body/div[@id="wrapper"]/div[@id="content"]/p/a[@class="p16"]/text()') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Data.Map as M | |
subst = [('a','y'),('b','n'), | |
('c','f'),('d','i'), | |
('e','c'),('f','w'), | |
('g','l'),('h','b'), | |
('i','k'),('j','u'), | |
('k','o'),('l','m'), | |
('m','x'),('n','s'), | |
('o','e'),('p','v'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Coroutine wrappers | |
function expect (token) | |
local this = coroutine.running() | |
return coroutine.yield(token, this) | |
end | |
function start (stream) | |
return coroutine.create(stream) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <vector> | |
#include <cstdlib> | |
#include <cstdio> | |
#include <time.h> | |
#include <sys/types.h> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(ctree). | |
-export([merge/2, split/2, add/2, add/3, remove/2, flatten/1, random/1, ordered/1, fromlist/1, remove_list/2, depth/1]). | |
% null / {Key, Param, Left, Right} | |
-record(cnode, {key, param, left, right}). | |
%% Объединяет 2 дерева (любой элемент левого меньше любого элемента правого) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(ctree). | |
-export([merge/2, split/2, add/2, add/3, remove/2, flatten/1, random/1, ordered/1, fromlist/1, remove_list/2, depth/1]). | |
% null / {Key, Param, Left, Right} | |
% Объединяет 2 дерева (любой элемент левого меньше любого элемента правого( | |
merge(null, B) -> B; | |
merge(A, null) -> A; | |
merge(A, B) -> | |
{A_key, A_param, A_left, A_right} = A, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define in(name) freopen(#name ".in", "r", stdin) | |
#ifdef DEBUG | |
# define out(name) | |
# define debug(f, args...) printf("[DEBUG] " f "\n", ##args) | |
#else | |
# define out(name) freopen(#name ".out", "w", stdout) | |
# define debug(...) | |
#endif |
NewerOlder