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
CC=cc | |
LIBS=-lncurses -lm | |
CFLAGS=-Wall -O3 | |
SRC=$(wildcard *.c) | |
OBJ=$(SRC:.c=.o) | |
TARGET=mandelbrot | |
all: ${OBJ} | |
${CC} $(CFLAGS) $(LIBS) $^ -o ${TARGET} |
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
# encoding: utf-8 | |
""" | |
python flask_stream_example.py | |
open http://localhost:9999/stream | |
""" | |
from flask import stream_with_context, request, Response, Flask | |
import time |
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
# coding: utf-8 | |
import re | |
from collections import OrderedDict | |
from pprint import pprint | |
KEY0 = re.compile(r'学科代码及名称:\d+\s+(\w+)') | |
KEY1 = re.compile(r'\n([A-C][\+-]?)') | |
DATA = re.compile(r'(\d+)\s+(\w+)') |
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
package com.jd.testGround; | |
import com.google.common.base.Joiner; | |
import java.util.Arrays; | |
import java.util.Collection; | |
import java.util.Collections; | |
import java.util.Comparator; | |
import java.util.Iterator; | |
import java.util.LinkedList; | |
import java.util.List; |
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
class Node: | |
left = right = None | |
def node_only(iterable_nodes): | |
return filter(bool, iterable_nodes) | |
def iter_layer(layer): | |
layer = node_only(layer) | |
while layer: | |
yield layer |
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
class BetterGen(object): | |
""" | |
BetterGen | |
""" | |
def __init__(self, gen): | |
self.gen = gen | |
self._next = None | |
self._stoped = False | |
self.try_next() |
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
115.221.60.130 - - [21/Mar/2015:01:59:32 +0800] "GET / HTTP/1.0" 200 1763 "-" "-" | |
115.221.60.130 - - [21/Mar/2015:01:59:42 +0800] "HEAD / HTTP/1.0" 405 0 "-" "-" | |
115.221.60.130 - - [21/Mar/2015:01:59:47 +0800] "TRACE HTTP://localhost HTTP/1.0" 405 172 "-" "-" | |
115.221.60.130 - - [21/Mar/2015:01:59:53 +0800] "TRACE / HTTP/1.0" 405 172 "-" "-" | |
115.221.60.130 - - [21/Mar/2015:02:00:00 +0800] "\x80\x80\x01\x03\x01\x00W\x00\x00\x00 \x00\x00\x16\x00\x00\x13\x00\x00" 400 172 "-" "-" | |
115.221.60.130 - - [21/Mar/2015:02:00:06 +0800] "\x03\x00\x00\x0B\x06\xE0\x00\x00\x00\x00\x00" 400 172 "-" "-" | |
115.221.60.130 - - [21/Mar/2015:02:00:18 +0800] "y\x08\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00 CKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\x00\x00!\x00\x01" 400 172 "-" "-" | |
115.221.60.130 - - [21/Mar/2015:02:00:30 +0800] "\x81\x00\x00D EBENEBFACACACACACACACACACACACACA\x00 EBENEBFACACACACACACACACACACACACA\x00" 400 172 "-" "-" | |
115.221.60.130 - - [21/Mar/2015:02:00:43 +0800] "\x00\x00\x00\x85\xFFSMBr\x00\x00\x00\x00\x18S\xC8\x00\x00\x00\x00\x0 |
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 requests import session | |
from bs4 import BeautifulSoup as bs | |
USER = 'USER' | |
PASSWORD = 'PASSWORD' | |
URL1 = 'https://github.com/login' | |
URL2 = 'https://github.com/session' | |
with session() as s: |
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
#!/usr/bin/env python | |
#coding=utf-8 | |
import requests | |
from BeautifulSoup import BeautifulSoup | |
username = 'MY GITHUB ACCOUNT' | |
password = 'MY GITHUB PASSWORD' | |
session = requests.Session() |
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
#!/usr/bin/env python | |
#coding=utf-8 | |
import requests | |
from BeautifulSoup import BeautifulSoup | |
username = 'MY GITHUB ACCOUNT' | |
password = 'MY GITHUB PASSWORD' | |
session = requests.Session() |