牌語備忘録 -pygo

あくまでもメモです。なるべくオフィシャルの情報を参照してください。

牌語備忘録 -pygo

2017-12-01から1ヶ月間の記事一覧

2017年を振り返る

よかった音楽 よかった本 よかった映画・ドラマ 買ってよかったもの 健康 技術的なことなど その他 感想 まとめ 自分のSNSなど見ながら雑に振り返ってみる よかった音楽 Suchmos/THE KIDS 1st の THE BAY も良い John Coltrane/ Love Supreme: The Complete …

Python で response に status_code とか存在するか確認するメモ

(python2.7.13) response = requests.get(hoge) とかして response に status_code とか無い場合に response.status_code とかするとエラーになるので確認 >>> hasattr(response, 'status_code') True

Python で『AttributeError: 'tuple' object has no attribute 'items'』とかなった場合のメモ

(python2.7.13) コード 実行結果 原因 コード def hoge(fuga): return { 'hoge': '{}'.format(fuga) }, print hoge('FUGA').items() 実行結果 AttributeError: 'tuple' object has no attribute 'items' 原因 戻り値のところ最後に間違ってカンマ入っちゃっ…

Python で16進数の範囲で文字を表示するメモ

(python2.7.13) 0x20-0x7e の範囲を表示したい >>> [chr(x) for x in range(0x20, 0x7e + 0x01)] [' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=…

Pythonでファイルをダウンロードしてみるメモ

(python2.7.13) 要 $ pip install requests # coding=utf8 import os import shutil import requests def download_file(url, file_dir): if not os.path.exists(file_dir): os.makedirs(file_dir) response = requests.get(url, stream=True) if response.s…

Pythonで作成日時に期限秒を足してみるメモ

(python2.7.13) 要 $ pip install python-dateutil In [1]: from datetime import datetime In [4]: expires_sec = 604799 # second In [5]: expires_sec * 1.0 / 60 / 60 Out[5]: 167.99972222222223 # hour (約7日) In [6]: from math import floor In […

Pythonでdatetimeオブジェクトとunixtimeのメモ

(python2.7.13) In [1]: from datetime import datetime In [2]: now = datetime.now() In [3]: now Out[3]: datetime.datetime(2017, 12, 12, 15, 42, 57, 966893) In [4]: int(now.strftime('%s')) Out[4]: 1513060977 In [5]: datetime.fromtimestamp(151…

RDS の slow_log が肥大化してた時のメモ

肥大化 ローテートしてみる バックアップも消す MySQL データベースログファイル - Amazon Relational Database Service 肥大化 mysql> select COUNT(*) from mysql.slow_log; +----------+ | COUNT(*) | +----------+ | 7890123 | +----------+ 1 row in se…

Pat Metheny のウォームアップエクササイズのメモ

書籍 Pat Metheny Guitar Etudes: Warmup Exercises for Guitar とセミナー動画のウォームアップエクササイズ Etudes Exercises 1 セミナー動画 スコア 参考リンク Etudes Exercises 1 Pat Metheny が弾いている音源は無いので一般の人がyoutubeにアップして…

Julian Lage Workshop 視聴メモ

Julian Lage Workshop (Japanese Subtitles) 8:22 まずはベースとメロディーだけを弾く そしてそれを交互に弾く 10:08 ひとつのアレンジされたソロを練習するのではなく、10個くらいのアレンジを即興で練習しました。 12:35 僕の世代のギタリストは 僕も含め…

GitHubのコメントで省略表示するメモ

よく忘れるんでメモ <details> ```python def factorial(x): if x == 0: return 1 else: return x * factorial(x - 1) ``` </details> クリックすると表示

Pythonとipinfo.ioのapiでIPの地域を調べるメモ

ipinfo.io api code 結果 リンク ipinfo.io api ipinfo.io の apiは1日1000回まで無料 Paid Plans - ipinfo.io code (python2.7.11) 要 $ pip install requests # coding=utf8 import requests def get_country(ips): result = [] for ip in ips: response =…