Skip to content

Instantly share code, notes, and snippets.

View sin-tanaka's full-sized avatar

tanasinn sin-tanaka

View GitHub Profile
@sin-tanaka
sin-tanaka / use_any.py
Last active June 6, 2017 07:10
any()を使った少しトリッキーな判定方法 ※見やすいが、短絡評価(short-circuit evaluation)しないので遅い
# all()関数のパターン
MATCH_WORDS = ['fuga', 'foobar']
def is_match(word):
judge = (
word in MATCH_WORDS,
word is 'hoge',
)
return any(judge)
/*
iを1〜100まで出力する
* iが3の倍数 ==> 'Fizz'
* iが5の倍数 ==> 'Buzz'
* iが3と5の公倍数 ==> 'Fizz-Buzz'
* それ以外 ==> 数値をそのまま出力
*/
#include <stdio.h>
int main(void){
@sin-tanaka
sin-tanaka / reactjs_vuejsチュートリアルまとめ.md
Last active August 30, 2017 01:51
react.js/vue.jsもくもく会用の(https://glnagano.connpass.com/event/64188/ ) のチュートリアルまとめ(2017-08-17時点)
@sin-tanaka
sin-tanaka / Setup.md
Created August 21, 2017 07:03
Django入門用 環境セットアップの補足手順

入門記事2の、「Python3のインストール」、が終わったらvenvを入れます。

Python3には標準で仮想環境の管理モジュール「venv」が付属しています。virtualenv, virtualenvwrapperより、こちらのほうが簡便です(仮想環境のパスを追加してくてもよい、又、標準付属なのでインストール不要)

venv — 仮想環境の作成

※以下全てpermission deniedとなったときはコマンドのあたまにsudo を付けてみてください

仮想環境の作成

@sin-tanaka
sin-tanaka / .gitconfig
Last active May 7, 2018 09:48
fzfでインタラクティブにgit checkout する ref: https://qiita.com/sin_tanaka/items/ca0fdd899e40a1d6716b
# ~中略~
[alias]
cof = !git branch -a | fzf | xargs git checkout
// https://docs.npmjs.com/getting-started/publishing-npm-packages
$ npm whoami
// error -> sign up to npm & npm login
// username -> ok
$ npm login
Username: sin_tanaka
Password:
Email: (this IS public) xxxxxx@xxxxxx.com
@sin-tanaka
sin-tanaka / sandbox_requests_html.ipynb
Created July 30, 2018 07:17
requests-htmlを触ってみる
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sin-tanaka
sin-tanaka / file0.txt
Last active September 10, 2018 14:38
tornado >= 5以上がインストールされたjupyter-notebook上でevent_loopを扱うとRuntimeError: This event loop is already runningになる ref: https://qiita.com/sin_tanaka/items/56eb1b8a677fb9b50f7b
import asyncio
from pyppeteer import launch
loop = asyncio.get_event_loop()
async def main():
browser = await launch()
page = await browser.newPage()
await page.goto('http://example.com')
await page.screenshot({'path': 'example.png'})
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sin-tanaka
sin-tanaka / transport_issue_gitlab_to_gitlab.py
Created September 28, 2018 05:28
Gitlab上で特定のリポジトリ以下のissueを別リポジトリのissueへ移行するスクリプト
import requests
import json
import time
GITLAB_PRIVATE_TOKEN = 'token_hogehoge_token'
export_pj_id = 'numxxxx'
import_pj_id = 'numxxxx'
export_pj_url = f"https://gitlab.com/api/v4/projects/{export_pj_id}/issues?state=opened&private_token={GITLAB_PRIVATE_TOKEN}"
import_pj_url = f"https://gitlab.com/api/v4/projects/{import_pj_id}/issues?private_token={GITLAB_PRIVATE_TOKEN}"