Skip to content

Instantly share code, notes, and snippets.

View icyrhyme's full-sized avatar

ZHOU Yilun icyrhyme

View GitHub Profile
package com.icyrhyme.concurrent;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static java.lang.Thread.sleep;
public class ThreadTest {
public static class MyThread extends Thread {
@Override
@icyrhyme
icyrhyme / imgur.py
Created October 23, 2012 11:02
upload the image file specified by the commandline argument, then save the image's url in the clip board (windows only)
# -*- coding:utf-8 -*-
import json
import sys
import urllib
import base64
import os
def addToClipBoard(text):
command = 'echo ' + text.strip() + '| clip'
@icyrhyme
icyrhyme / dinic.cpp
Created July 25, 2012 18:11
simple implementation of Dinic's algorithm for solving maxflow problem
#define MAX 500
class Dinic {
int n, m, head[MAXN], level[MAXN], s, t, work[MAXN];
struct edge {
int v, c, f, nxt;
edge() {}
edge(int v, int c, int f, int nxt): v(v), c(c), f(f), nxt(nxt) {}
} e[MAXM];
bool _bfs() {
static int q[MAXN];