Skip to content

Instantly share code, notes, and snippets.

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

Avinash avinash-mishra

🎯
Focusing
View GitHub Profile
@avinash-mishra
avinash-mishra / AWS-CLI.md
Last active September 10, 2018 08:02 — forked from stevenyap/AWS-CLI.md
AWS S3 Command Line

S3 Syncing

# sync from bucket to local
aws s3 sync <bucket> <target_folder> <options>
aws s3 sync s3://mybucket . --acl public-read

aws s3 sync --region ap-northeast-1 s3://[移動元バケット名] s3://[移動先バケット名]
@vepetkov
vepetkov / hdfs_pq_access.py
Created September 4, 2018 11:10
Python HDFS + Parquet (hdfs3, PyArrow + libhdfs, HdfsCLI + Knox)
##################################################################
## Native hdfs access (only on the cluster)
# conda install -c conda-forge libhdfs3=2.3.0=1 hdfs3 --yes
import hdfs3
import pandas as pd
nameNodeHost = 'hadoopnn1.localdomain'
nameNodeIPCPort = 8020
hdfs = hdfs3.HDFileSystem(nameNodeHost, port=nameNodeIPCPort)
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active May 6, 2025 14:17
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;