Skip to content

Instantly share code, notes, and snippets.

View KoheiKanagu's full-sized avatar
🏠
Working from home

KoheiKanagu KoheiKanagu

🏠
Working from home
View GitHub Profile
@KoheiKanagu
KoheiKanagu / delete.sh
Last active August 29, 2016 11:54
ParseのAPIを叩くいろいろ
#Slackにアップロードされたファイルを一括削除
token="__YOUR_API_KEY__"
timeStamp=1451573999 #2015年12月31日23時59分
fileCount=`curl -s "https://slack.com/api/files.list?token=${token}&ts_to=${timeStamp}&pretty=1&count=${fileCount}" | jq .paging.total`
echo $fileCount 件
files=`curl "https://slack.com/api/files.list?token=${token}&ts_to=${timeStamp}&pretty=1&count=${fileCount}"| jq ".files[].id" | sed -e "s/\"//g"`
for var in $files
do

#atom-sync-settings.md

@KoheiKanagu
KoheiKanagu / pset.py
Last active November 4, 2017 09:01
venvを使ってPythonの環境をローカルに構築して、VSCodeで開くツール。http://qiita.com/KoheiKanagu/items/752c64aeeb154970d22e
import argparse
import os.path
import subprocess
parser = argparse.ArgumentParser(
description="This script deitals : http://qiita.com/KoheiKanagu/items/752c64aeeb154970d22e"
)
parser.add_argument(
"--init",
import nbformat
import os
import sys
file_name = sys.argv[1]
def parse(code: list) -> nbformat.v4:
nb = nbformat.v4.new_notebook()
nb["cells"] = []
extension on num {
Duration get second => Duration(seconds: toInt());
Duration get millisecond => Duration(milliseconds: toInt());
}
extension on Duration {
Future<void> get delay => Future.delayed(this);
}
@KoheiKanagu
KoheiKanagu / openurl.sh
Last active June 4, 2020 06:53
iOSシミュレータや接続された実機でURL開く
#!/bin/sh
# `xcrun simctl list` で対象デバイスのUUIDを見つける
xcrun simctl openurl D6541EDA-06AC-465D-A178-93CC2093DAB8 https://example.com
@KoheiKanagu
KoheiKanagu / GoogleService-Info_Copy_Script.sh
Last active July 25, 2020 14:38
GoogleService-Info.plistをFlavor毎に切り替えるRunScript
# 参考: [flutterで本番/ステージング/開発を切り替える \- Qiita](https://qiita.com/ko2ic/items/53f97bb7c28632268b5a#%E7%92%B0%E5%A2%83%E3%81%94%E3%81%A8%E3%81%AE%E8%A8%AD%E5%AE%9A)
rm -rf "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist"
echo "-----${CONFIGURATION}-----"
echo "-----${SRCROOT}-----"
if [ "${CONFIGURATION}" = "Debug" ] || [ "${CONFIGURATION}" = "Debug-Dev" ] || [ "${CONFIGURATION}" = "Release-Dev" ]; then
cp "$SRCROOT/Runner/GoogleService-Info-dev.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist"
echo "dev GoogleService-Info copied."
@KoheiKanagu
KoheiKanagu / flutterSertupWithFvm.sh
Last active November 17, 2020 12:51
fvm使って初回のFlutterの環境構築する
#!/bin/bash -eu
# fvm is https://github.com/leoafarias/fvm
# https://flutter.dev/docs/get-started/install/macos から最新のものを参照すること
FLUTTER_ZIP="flutter_macos_1.22.4-stable.zip"
curl -O "https://storage.googleapis.com/flutter_infra/releases/stable/macos/$FLUTTER_ZIP"
unzip $FLUTTER_ZIP
@KoheiKanagu
KoheiKanagu / main.dart
Last active September 16, 2020 05:05
() => String' is not a subtype of type '(() => Null)?
void main() async {
final futures = <Future<String>>[];
final waited = await Future.wait(futures);
final actual = waited.singleWhere(
(element) => element == 'Hello1',
orElse: () => 'unknown',
);
@KoheiKanagu
KoheiKanagu / main.dart
Last active September 16, 2020 05:08
success
void main() async {
final futures = <Future<String>>[
Future.delayed(
Duration(seconds: 1),
() => 'Hello1',
),
Future.delayed(
Duration(seconds: 2),
() => 'Hello2',
),