This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p ~/.config/fish/completions | |
# docker | |
curl https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/fish/docker.fish -o ~/.config/fish/completions/docker.fish | |
# docker-compose | |
curl https://raw.githubusercontent.com/docker/compose/master/contrib/completion/fish/docker-compose.fish -o ~/.config/fish/completions/docker-compose.fish | |
# kubectl (非公式) | |
curl https://raw.githubusercontent.com/evanlucas/fish-kubectl-completions/master/completions/kubectl.fish -o ~/.config/fish/completions/kubectl.fish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(lubridate) | |
library(googleAuthR) | |
library(bigQueryR) | |
options( | |
googleAuthR.client_id = Sys.getenv("GOOGLE_CLIENT_ID"), | |
googleAuthR.webapp.client_id = Sys.getenv("GOOGLE_CLIENT_ID"), | |
googleAuthR.client_secret = Sys.getenv("GOOGLE_CLIENT_SECRET"), | |
googleAuthR.webapp.client_secret = Sys.getenv("GOOGLE_CLIENT_SECRET"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# summarise_allで適用する関数にオプション引数を与える実験 | |
library(tidyverse) | |
data <- read_csv(' | |
a,x | |
A,1 | |
A,2 | |
A,3 | |
B, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -d --sort=time /var/log/shiny-server/* | head -n1 | xargs tail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# サンプルコード: 10日おきに12:00の時刻ベクトルを生成 | |
library(tidyverse) | |
library(lubridate) | |
# 日付のベクトルを作成 | |
sent_time <- seq(as_date("2018-01-01"), as_date("2019-12-31"), by = "10 days") | |
# POSIXct型に変換 | |
sent_time <- as_datetime(sent_time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud container clusters create experiment-cluster \ | |
--machine-type=n1-standard-1 \ | |
--preemptible \ | |
--enable-autoscaling --max-nodes=3 --min-nodes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fish shellでMinikubeを起動・設定する関数 | |
# Minikubeを起動、dockerコマンドでMinikubeのDockerデーモンを使うよう設定する | |
# | |
# インストール: | |
# ~/.config/fish/functions/minikube_setup.fish | |
# に保存する | |
# | |
function minikube_setup | |
echo "Minikubeのバージョンを調べます" | |
echo "コマンド> minikube version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- BigQueryで連番の日付を生成する例 | |
-- Standard SQL を使用 | |
-- 2019-04-01 から 2020-03-31 まで | |
SELECT | |
DATE_ADD(start_date.start_date, INTERVAL n.n DAY) AS date | |
FROM ( | |
SELECT | |
DATE('2019-04-01') AS start_date) AS start_date | |
LEFT JOIN ( | |
SELECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- BigQueryで列 my_column のBOM (Byte Order Mark) を削除 | |
SELECT | |
REGEXP_REPLACE(my_column, '''\ufeff''', '') | |
FROM | |
my_table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 応用例 | |
# Docker Desktopのk8sのconfigにdefault-tokenを設定する | |
kubectl config set-credentials docker-desktop --token="$(kubectl -n kube-system get secret | grep default-token | awk '{print $1}' | xargs -IXXX kubectl -n kube-system get secret XXX -o jsonpath='{.data.token}' | base64 --decode)" |
OlderNewer