Skip to content

Instantly share code, notes, and snippets.

[
[
"Advance Publications Newspapers",
"http://www.nexis.com/results/shared/sourceInfo.do?csi=309307"
],
[
"Abilene Reporter-News (Texas)",
"http://www.nexis.com/results/shared/sourceInfo.do?csi=317181"
],
[
urls = [
'http://www.baltimorenews.net/index.php/sid/234363921',
'http://www.baltimorenews.net/index.php/sid/234323971',
'http://www.atlantanews.net/index.php/sid/234323891',
'http://www.wpbf.com/news/funeral-held-for-gabby-desouza/33874572',
'http://www.tennessean.com/story/news/politics/2015/06/30/obama-focus-future-health-care-burwell-says/29540753/',
'http://www.atlantanews.net/index.php/sid/234323901',
'http://www.baltimorenews.net/index.php/sid/234323975',
'http://www.utsandiego.com/news/2015/jun/30/backcountry-lilac-development-opposition-general/',
'http://www.newsnet5.com/newsy/apples-ebook-pricing-scandal-a-long-road-to-a-small-fine',
from sklearn.cross_validation import train_test_split
df = pd.DataFrame(np.random.randn(100, 2), columns=['x1', 'x2'])
df['y'] = np.random.choice([0, 1], size=len(df), p=[0.1, 0.9])
train, test = train_test_split(df, test_size=0.2, stratify=df.y)
train.y.value_counts()
test.y.value_counts()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
for file in *.json
do
cat "$file" | python -m json.tool > "$file.new"
mv -f "$file.new" "$file"
done
class Openfst < Formula
homepage "http://www.openfst.org/"
url "http://openfst.cs.nyu.edu/twiki/pub/FST/FstDownload/openfst-1.4.1.tar.gz"
sha256 "e671bf6bd4425a1fed4e7543a024201b74869bfdd029bdf9d10c53a3c2818277"
needs :cxx11
def install
ENV.cxx11
system "./configure", "--prefix=#{prefix}",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import bokeh.charts
from bokeh.models import HoverTool, ColumnDataSource
from bokeh.plotting import figure
def plot_interactive_timeseries(df, col):
# https://github.com/bokeh/bokeh/pull/3883
hover = HoverTool(tooltips=[
("y (%s)" % col, "$y{1.11}"),
@AlJohri
AlJohri / colourised_log_example.py
Created May 6, 2016 21:13 — forked from exhuma/colourised_log_example.py
Simple python log formatter for colourised terminal output.
"""
Example for a colourised logging output.
This example uses "blessings" to handle console escape sequences. ``blessings``
itself is a very harmless package in that it does not have any external
dependencies. And it's code-base is very clean and small.
The example extends the core logging formatter (logging.Formatter) and
colourises the complete line. This takes advantage of any upstream updates
related to logging. When writing this against Python 2.7, the parent code