Skip to content

Instantly share code, notes, and snippets.

View ogrew's full-sized avatar

ayato ogrew

View GitHub Profile
@ogrew
ogrew / file0.txt
Last active August 25, 2017 12:00
Titanic号沈没データの解析をそれっぽくしてみる ref: http://qiita.com/ogrew/items/3bf7c22cf35c5b57bf9d
import pandas as pd
from pandas import Series, DataFrame
@ogrew
ogrew / file0.txt
Created December 17, 2016 18:02
Plotlyを使ってインタラクティブなグラフを描いてみたら、思っていた以上だった。 ref: http://qiita.com/taiga_6404/items/e6ba517cec9fb5161cb6
import plotly
plotly.__version__
@ogrew
ogrew / config.py
Last active July 14, 2018 07:12
Pythonでサクッと簡単にTwitterAPIを叩いてみる ref: https://qiita.com/ogrew/items/0b267f57b8aaa24f1b73
CONSUMER_KEY = "**************"
CONSUMER_SECRET = "**************"
ACCESS_TOKEN = "**************"
ACCESS_TOKEN_SECRET = "**************"
@ogrew
ogrew / file1.txt
Last active January 10, 2017 09:22
PythonでRPNの計算をしてみる(初心者向け) ref: http://qiita.com/taiga_6404/items/8ae360ff648f99bf6c15
$ python rpn.py 37+621-*+
RPN: 37+621-*+
[3]
[3, 7]
3 + 7 =
[10]
[10, 6]
[10, 6, 2]
[10, 6, 2, 1]
2 - 1 =
@ogrew
ogrew / file0.txt
Last active January 11, 2017 15:35
インクリメント、デクリメント演算子のないPythonの話。 ref: http://qiita.com/taiga_6404/items/20a92b0d2567f09ff267
>>> i=1
>>> i++
SyntaxError: invalid syntax
abb = ("NY","TX","MA","WA","CT")
state = ("New York", "Texas", "Massachusetts", "Washington", "Connecticut")
comprehension_dict = {i:j for i,j in zip(abb,state)}
# {'WA': 'Washington','TX': 'Texas','NY': 'New York','MA': 'Massachusetts','CT': 'Connecticut'}
@ogrew
ogrew / pelican.txt
Last active February 5, 2017 06:01
Pythonの静的サイトジェネレータ"Pelican"でお手軽にブログをはじめる手順 ref: http://qiita.com/taiga_6404/items/ecef0a4700d5bd4d875d
$ pip install ghp-import
$ ghp-import output
$ git commit -m "first post"
$ git push -f origin gh-pages:master
@ogrew
ogrew / 10knock.py
Last active February 5, 2017 06:00
せっかくだし自然言語処理100本ノック1章(準備運動) ref: http://qiita.com/taiga_6404/items/4578a8056c657e1ef056
import random
def typoglycemia(target):
res = []
for s in target.split():
if len(s) < 5:
res.append(s)
else:
head = s[0]
tail = s[-1]
@ogrew
ogrew / file0.sh
Last active December 7, 2017 13:26
perlで switch vs when vs if ref: https://qiita.com/ogrew/items/c6199be75d666efce130
$ cpanm Switch
--> Working on Switch
Fetching http://www.cpan.org/authors/id/C/CH/CHORNY/Switch-2.17.tar.gz ... OK
Configuring Switch-2.17 ... OK
Building and testing Switch-2.17 ... OK
Successfully installed Switch-2.17
1 distribution installed
@ogrew
ogrew / data_page.pl
Created March 14, 2018 05:42
Data::Pageモジュールの検証
use Data::Page;
my $total_entries = 18;
my $entries_per_page = 3;
my $current_page = 4;
my $page = Data::Page->new($total_entries, $entries_per_page, $current_page);
print " First page: ", $page->first_page, "\n";
print " Last page: ", $page->last_page, "\n";