Skip to content

Instantly share code, notes, and snippets.

@u1and0
u1and0 / dict.getメソッド
Created September 13, 2016 04:59
ディクショナリにデフォルト値ってないのか? ref: http://qiita.com/u1and0/items/e587bb26198739976281
dic={'a':6,'b':4}
# $ dic['a']
# 6
# $ dic['b']
# 4
# $ dic['c']   # キーにない値が入力されるとエラー
# ---------------------------------------------------------------------------
# KeyError Traceback (most recent call last)
$grep --color=always -nriC1 "arg" ./*
@u1and0
u1and0 / get_feed.py
Last active December 7, 2016 13:56
コマンドライン上でRSSを取得し続ける ref: http://qiita.com/u1and0/items/08451d339454dc979a69
from datetime import datetime
from time import mktime
import feedparser
from tqdm import tqdm
from time import sleep
# RSSのURL
RSS_URL = "http://www.fxstreet.jp/rss/news/forex-news/"
# RSSの取得
@u1and0
u1and0 / .bash_aliases
Last active September 23, 2016 13:37
MSYS2設定ファイルを弄る ref: http://qiita.com/u1and0/items/b4c3217868cf8bafb085
alias g='git'
alias py='python'
alias ipy='ipython'
@u1and0
u1and0 / 1.1
Last active October 9, 2016 00:57
python docstring内にテストを記述 ref: http://qiita.com/u1and0/items/3a7b73dca38414f3a703
1 items had no tests:
__main__
1 items passed all tests:
2 tests in __main__.twice
2 tests in 2 items.
2 passed and 0 failed.
Test passed.
body...
@echo off
jupyter-nbconvert --to latex %1 --template jsarticle.tplx
extractbb %2_files/*.png
@u1and0
u1and0 / startup.ipy(改良前)
Last active November 12, 2016 14:49
スタートアップ時にインポート中のモジュールを表示 ref: http://qiita.com/u1and0/items/aae3e24c73692d28f501
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns # <- matplotlibの強化版
@u1and0
u1and0 / file0.txt
Last active October 22, 2019 10:27
matplotlib, seabornの日本語表示 ref: https://qiita.com/u1and0/items/3b4d0f3e5514c9893d89
sns.set(font=['IPAMincho'])
@u1and0
u1and0 / %autoreload()
Last active July 22, 2018 09:00
Jupyter, Ipythonの設定 ~起動、グラフの日本語表示、エイリアス、インライン表示、スタートアップモジュールインポート~ ref: https://qiita.com/u1and0/items/a926a7be5d182932a929
[In] %load_ext autoreload # マジックコマンド%autoreloadをロードする
[In] %autoreload hello
[In] hello.hello()
[Out] f**k!
@u1and0
u1and0 / file0.txt
Last active November 26, 2016 14:33
pythonで作るサンプルデータ ref: http://qiita.com/u1and0/items/0625f7a1cd9b476270bb
n=20