Skip to content

Instantly share code, notes, and snippets.

View avinash-mishra's full-sized avatar
🎯
Focusing

Avinash avinash-mishra

🎯
Focusing
View GitHub Profile
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active May 3, 2024 12:56
Online Resources For Web Developers (No Downloading)
@kakakaya
kakakaya / output.txt
Created March 14, 2018 10:09
markovify example
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.
@zhreshold
zhreshold / check_platform.py
Last active May 30, 2019 14:39
Check OS/Python/Cpu Info and Network connections
"""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
# 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')
@naotokui
naotokui / ja_sentence_tokenize.py
Created May 9, 2017 01:28
Japanese sentence tokenizer - 日本語 - 文に分ける 簡易版
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)
@tag1216
tag1216 / 01_thread.py
Created April 2, 2017 12:19
Pythonでconcurrent.futuresを使った並列タスク実行
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()
@Integralist
Integralist / capture logger output.py
Last active September 28, 2020 14:05
[Python3 Logging] Simple Python3 Logging Configuration #logs #python #python3 #structured #logging #structlog #capture
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

Metadata

#Selecting a database	
USE database;	USE database;

#Listing databases	
SHOW DATABASES;	SHOW DATABASES;
@abachman
abachman / notes.md
Created February 7, 2017 19:05
Cassandra data modeling notes

Based on http://datascale.io/cassandra-partitioning-and-clustering-keys-explained/

Primary Keys

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.

@vkroz
vkroz / Kafka commands.md
Last active January 21, 2024 12:12
Kafka frequent commands

Kafka frequent commands

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

Server

Start Zookepper and Kafka servers