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 / 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}"
@sin-tanaka
sin-tanaka / tslint.json
Created October 19, 2018 01:34
TSLint v5.7.0 時点で指定できる全 rules を網羅した。
// tslint.json : https://palantir.github.io/tslint/
{
// Type Checking を有効にする (true)
"lintOptions": {
"typeCheck": true
},
// カスタムルールの参照先
"rulesDirectory": [
"node_modules/codelyzer"
],
const jsonStr = '{"foo": "bar"}'
const jsonObj = JSON.parse(Buffer.from(jsonStr, 'base64').toString())
// 参考: https://qiita.com/yamikoo@github/items/5dbcc77b267a549bdbae
export function zenkakuToHankaku(str: string): string {
return str.replace(/[A-Za-z0-9]/g, (s) => {
return String.fromCharCode(s.charCodeAt(0) - 0xFEE0);
});
}
<template>
<div>
<input id="copy-text" value="copy text" />
</div>
</template>
<script>
export default {
methods: {
copyToClipboard: function() {
@sin-tanaka
sin-tanaka / server.py
Created December 11, 2019 09:02 — forked from martijnvermaat/server.py
SimpleHTTPServer with history API fallback
#!/usr/bin/env python
"""
Modification of `python -m SimpleHTTPServer` with a fallback to /index.html
on requests for non-existing files.
This is useful when serving a static single page application using the HTML5
history API.
"""
@sin-tanaka
sin-tanaka / decompress_tar_bro.py
Created March 17, 2020 07:36
tar→brotliで圧縮してあるファイルをインメモリ上で解凍するサンプル お焚き上げ
"""
やったこと
- brotliの解凍
- tarballの解凍
- brotliで解凍したものをインメモリ上で保持してファイルとして扱い、更にtarballで展開する
背景
- AWS Lambda上の/tmp領域にそこそこ大きめのbinaryを展開したかった
- Lambdaの/tmp領域の制限(500mぐらい)の関係でインメモリ上でやりたい(brotliで展開したやつを一回書き出すみたいなことをしたくない)
- IOのロス、展開後の容量とか気にしなくていい場合、brotliで解凍→普通にファイルをwrite→更にread→tarballで解凍のようにリッチにやるのも可

Qiita Clone

Qiita のClone

Qiitaは、エンジニアに関する知識を記録・共有するためのサービスです。

できること

MUST