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: https://github.com/dpkp/kafka-python/blob/master/example.py | |
import threading, logging, time | |
import multiprocessing | |
from kafka import KafkaConsumer, KafkaProducer | |
class Producer(threading.Thread): | |
def __init__(self): |
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 | |
import requests | |
from bs4 import BeautifulSoup | |
def join_str(contents): | |
strings = [] | |
for content in contents: | |
if isinstance(content, basestring): | |
strings.append(content) |
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
pub_date = `date +'%y.%m.%d %H:%M:%S'` | |
messages = "Auto published by yydai at $(pub_date)" | |
publish: | |
@echo "======================================" | |
@echo "Begin publish the site, please wait..." | |
@echo "======================================" | |
@git add . | |
@-git commit -m $(messages) |
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
var base_url = 'https://api.github.com'; | |
var title = document.title; | |
var owner = 'yydai'; | |
var repo = 'yydai.github.io'; | |
var search_issues = base_url + '/search/issues?q=' + title + '+user:' + owner; | |
function test() { | |
jQuery.ajax({ | |
type: 'GET', |
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
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> | |
<script> | |
jQuery.ajax({ | |
type: 'GET', | |
dataType:'json', | |
url: 'https://api.github.com/repos/yydai/yydai.github.io/issues/1/comments', | |
success: function(data){ | |
//marker = JSON.stringify(data); | |
//alert(marker); |
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
/** Grammars always start with a grammar header. This grammar is called | |
* ArrayInit and must match the filename: ArrayInit.g4 | |
*/ | |
grammar ArrayInit; | |
/** A rule called init that matches comma-separated values between {...}. */ | |
init : '{' value (',' value)* '}' ; // must match at least one value | |
/** A value can be either a nested array/struct or a simple integer (INT) */ | |
value : init |
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
/*** | |
* Excerpted from "The Definitive ANTLR 4 Reference", | |
* published by The Pragmatic Bookshelf. | |
* Copyrights apply to this code. It may not be used to create training material, | |
* courses, books, articles, and the like. Contact us if you are in doubt. | |
* We make no guarantees that this code is fit for any purpose. | |
* Visit http://www.pragmaticprogrammer.com/titles/tpantlr2 for more book information. | |
***/ | |
import org.antlr.v4.runtime.*; | |
import org.antlr.v4.runtime.tree.ParseTree; |
NewerOlder