https://stackoverflow.com/questions/2081836/reading-specific-lines-only-python
with open("file") as fp:
for i, line in enumerate(fp):
if i == 25:| /*** | |
| * 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; |
| /** 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 |
| <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); |
| 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', |
| 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) |
| #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) |
| # 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): |
https://stackoverflow.com/questions/2081836/reading-specific-lines-only-python
with open("file") as fp:
for i, line in enumerate(fp):
if i == 25:| import matplotlib.pyplot as plt | |
| x = np.linspace(-5, 5, 200) # x data, shape=(100, 1) | |
| y1 = 2 * x #... | |
| y2 = x ** 2 + 2 | |
| y3 = sin(x) | |
| plt.figure(1, figsize=(8, 6)) | |
| plt.subplot(221) |
| #include <iostream> | |
| #include <stdio.h> | |
| #include <vector> | |
| #include <string> | |
| #define N 256 | |
| using namespace std; | |
| struct TreeNode { | |
| bool isEnd; |