Skip to content

Instantly share code, notes, and snippets.

import argparse
def get_args():
parser = argparse.ArgumentParser(description='This is sample argparse script')
parser.add_argument('-n', '--name', default='hogehoge', type=str, help='This is name.')
parser.add_argument('-a', '--age', default=30, type=int, help='This is age')
parser.add_argument('-s', '--sex', default='male', type=str, choices=['male', 'female'], help='This is sex')
return parser.parse_args()

参照する記事

ボリューム、ファイルシステムの状況確認

ファイルシステムの状況を確認する df -h コマンド。

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             94G     0   94G   0% /dev
{
"workbench.startupEditor": "newUntitledFile",
"workbench.sideBar.location": "left",
"editor.minimap.showSlider": "always",
"editor.minimap.renderCharacters": false,
"files.autoGuessEncoding": true,
"vim.useSystemClipboard": true,
//For vim
//Set s as leader
"vim.leader": "s",
for (var i = 1; i < 100001; i++) {
if (i % 15 === 0) {
document.write('FizzBuzz ');
} else if (i % 5 === 0) {
document.write('Buzz ');
} else if (i % 3 === 0) {
document.write('Fizz ');
} else {
document.write(i + ' ');
}
@tkazusa
tkazusa / flickr_image_download.py
Created December 25, 2019 14:47
Download iamges with flickr API
"""
To utilize flickr API, you need to parse a config.json like bellow.
{
"Key": "XXXX",
"Secret": "XXXX",
"Keywords": "XXXX",
"Per_page": "XXXX",
}
"""
@tkazusa
tkazusa / flickr_image_download.py
Created December 25, 2019 14:47
Download iamges with flickr API
"""
To utilize flickr API, you need to parse a config.json like bellow.
{
"Key": "XXXX",
"Secret": "XXXX",
"Keywords": "XXXX",
"Per_page": "XXXX",
}
"""
@tkazusa
tkazusa / flickr_image_download.py
Created December 25, 2019 14:47
Download iamges with flickr API
"""
To utilize flickr API, you need to parse a config.json like bellow.
{
"Key": "XXXX",
"Secret": "XXXX",
"Keywords": "XXXX",
"Per_page": "XXXX",
}
"""
import boto3
sts_client = boto3.client("sts")
session = boto3.session.Session()
account_id = sts_client.get_caller_identity()["Account"]
region = session.region_name
credentials = session.get_credentials()
credentials = credentials.get_frozen_credentials()
from gensim import corpora, models
from gensim.matutils import corpus2dense, corpus2csc
def tfidfvectorizer(df: pd.DataFrame) -> np.ndarray:
documents = list(train.name)
texts = list(map(lambda x: x.split(), documents))
dct = corpora.Dictionary(texts)
corpus = [dct.doc2bow(line) for line in texts]
tfidf= models.TfidfModel(corpus)