- Text Content Generator - http://www.lipsum.com
- Favicon Generator - http://tools.dynamicdrive.com/favicon
- Data Generator - https://mockaroo.com/
- Mobile Mockup Generator - https://mockuphone.com
- Logo Generator - https://www.logaster.com
- UUID Generator - https://www.uuidgenerator.net/
- Hash Generator - https://passwordsgenerator.net/sha256-hash-generator/
- Ultimate Code Generator - https://webcode.tools/
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
The Zen of Python, by Tim Peters | |
Beautiful is better than ugly. | |
Explicit is better than implicit. | |
Simple is better than complex. | |
Complex is better than complicated. | |
Flat is better than nested. | |
Sparse is better than dense. | |
Readability counts. | |
Special cases aren't special enough to break the rules. |
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
"""Diagnose script for checking OS/hardware/python/pip/mxnet/network. | |
The output of this script can be a very good hint to issue/problem. | |
""" | |
import platform, subprocess, sys, os | |
import socket, time | |
try: | |
from urllib.request import urlopen | |
from urllib.parse import urlparse | |
except ImportError: | |
from urlparse import urlparse |
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
# See official docs at https://dash.plotly.com | |
# pip install dash pandas | |
from dash import Dash, dcc, html, Input, Output | |
import plotly.express as px | |
import pandas as pd | |
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv') |
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
import re | |
import nltk | |
sent_detector = nltk.RegexpTokenizer(u'[^ !?。]*[!?。.\n]') | |
sents = sent_detector.tokenize(u" 原子番号92のウランより重い元素は全て人工的に合成され、118番まで発見の報告がある。\ | |
113番については、理研と米露の共同チームがそれぞれ「発見した」と報告し、国際純正・応用化学連合と国際純粋・応用物理学連合の合同作業部会が審査していた。両学会は「データの確実性が高い」ことを理由に、理研の発見を認定し、31日に森田さんに通知した。未確定だった115番と117番、118番の新元素は米露チームの発見を認めた。森田さんは「周期表に名前が残ることは感慨深い。大勢の共同研究者にまずは感謝したい」と述べた。 \n") | |
for s in sents: | |
print s, len(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
import time | |
from concurrent.futures import ThreadPoolExecutor | |
from logging import StreamHandler, Formatter, INFO, getLogger | |
def init_logger(): | |
handler = StreamHandler() | |
handler.setLevel(INFO) | |
handler.setFormatter(Formatter("[%(asctime)s] [%(threadName)s] %(message)s")) | |
logger = getLogger() |
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
import io | |
import logging | |
logger = logging.getLogger("your_logger") | |
logger.setLevel(logging.INFO) | |
logger_output = io.StringIO() | |
logger.addHandler(logging.StreamHandler(logger_output)) | |
# do stuff that triggers some logs |
Based on http://datascale.io/cassandra-partitioning-and-clustering-keys-explained/
A single column Primary Key is also called a Partition Key.
When Cassandra is deciding where in the cluster to store this particular piece of data, it will hash the partition key. The value of that hash dictates where the data will reside and which replicas will be responsible for it.
Assuming that the following environment variables are set:
KAFKA_HOME
where Kafka is installed on local machine (e.g./opt/kafka
)ZK_HOSTS
identifies running zookeeper ensemble, e.g.ZK_HOSTS=192.168.0.99:2181
KAFKA_BROKERS
identifies running Kafka brokers, e.g.KAFKA_BROKERS=192.168.0.99:9092
Start Zookepper and Kafka servers