Skip to content

Instantly share code, notes, and snippets.

Avatar

Yuichiro MASUI masuidrive

View GitHub Profile
@masuidrive
masuidrive / translate_slack_bot.js
Last active Apr 29, 2020
Slack用Google翻訳Bot on Firebase Functions
View translate_slack_bot.js
const functions = require('firebase-functions');
const request = require('request');
const { Translate } = require('@google-cloud/translate');
/*
Firebase Functionsの環境変数
slack.bot_user_tokenとgoogle.project_idを適当に設定してください
*/
async function postMessage(payload) {
@masuidrive
masuidrive / setup_docker_node_ruby.sh
Last active Oct 8, 2019
Docker, NodeとRubyの開発環境作り
View setup_docker_node_ruby.sh
#!/bin/sh
RUBY_VERSION=2.6.3
NODE_VERSION=12
# install docker
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
@masuidrive
masuidrive / set_mydns_and_letencrypt.sh
Last active Oct 8, 2019
mydnsのLet's Encryptを設定するスクリプト
View set_mydns_and_letencrypt.sh
#!/bin/bash
# Usage:
# GROUP=1003 MYDNSJP_DOMAIN=XXXX.mydns.jp MYDNSJP_MASTERID=mydnsXXXXX MYDNSJP_MASTERPWD=XXXX EMAIL=mydns@example.com sh set_mydns_and_ssl.sh
apt install -y php php-mbstring certbot unzip
mkdir -p /usr/local/mydns
cd /usr/local/mydns
wget 'https://github.com/disco-v8/DirectEdit/archive/master.zip' -O DirectEdit-master.zip
unzip -f ./DirectEdit-master.zip
@masuidrive
masuidrive / install_code_server.sh
Last active Dec 5, 2019
Install code-server on Coder
View install_code_server.sh
#!/bin/bash
VERSION=${VERSION:-2.1523-vsc1.38.1}
WORK_DIR=/home/ubuntu/projects
USER_ID=1000
GROUP_ID=1000
PORT=8888
TARBALL_URL=https://github.com/cdr/code-server/releases/download/$VERSION/code-server$VERSION-linux-x86_64.tar.gz
@masuidrive
masuidrive / install_softether.sh
Last active Oct 2, 2019
Install SoftEther server to Ubuntu
View install_softether.sh
#!/bin/bash
SE_URL=${SE_URL:-https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.29-9680-rtm/softether-vpnserver-v4.29-9680-rtm-2019.02.28-linux-x64-64bit.tar.gz}
apt-get update
apt install -y bridge-utils gcc make
curl -L $SE_URL | tar xfz - -C /usr/local/
cd /usr/local/vpnserver
yes 1 | make
@masuidrive
masuidrive / set_softether.sh
Last active Oct 7, 2019
SoftEtherの初期設定を行う
View set_softether.sh
#!/bin/bash
SE_USERNAME="${SE_USERNAME:-vscode}"
SE_PASSWORD="${SE_PASSWORD:-`more /dev/urandom | tr -d -c '[:alnum:]' | fold -w 8 | head -1`}"
SE_PSK="${SE_PSK:-vpn}"
HOST_IP="${HOST_IP:-`ip -f inet -o addr show eth0|cut -d\ -f 7 | cut -d/ -f 1`}"
DHCP_GW="${DHCP_GW:-192.168.28.1}"
DHCP_START="${DHCP_START:-192.168.28.100}"
View shopifyの都道府県
'Aichi': '愛知県',
'Akita': '秋田県',
'Aomori': '青森県',
'Chiba': '千葉県',
'Ehime': '愛媛県',
'Fukui': '福井県',
'Fukuoka': '福岡県',
'Fukushima': '福島県',
'Gifu': '岐阜県',
'Gunma': '群馬県',
@masuidrive
masuidrive / rails-auth0.patch
Last active Sep 12, 2019
curl -L THIS | patch -p1でRailsにAuth0をインストールする https://auth0.com/docs/quickstart/webapp/rails/01-login
View rails-auth0.patch
diff --git a/.env b/.env
new file mode 100644
index 0000000..437bf23
--- /dev/null
+++ b/.env
@@ -0,0 +1,3 @@
+AUTH0_DOMAIN=XXXXXX.auth0.com
+AUTH0_CLIENT_ID=XXXXX
+AUTH0_CLIENT_SECRET=XXXXXX
\ No newline at end of file
@masuidrive
masuidrive / install.sh
Last active Oct 7, 2018
Install gcloud cli to CODER.com
View install.sh
# install for gcloud cli
# https://docs.coder.com/docs/tech-faqs
apt install python2.7 python-pip -y
# install yarn for node
curl -o- -L https://yarnpkg.com/install.sh | sh
# install gcloud
curl -o- -L https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-219.0.1-linux-x86_64.tar.gz | tar xfz - -C /usr/local
@masuidrive
masuidrive / remove_bak.sh
Created Jul 5, 2018
bakファイルだけを.Trashへ移動する
View remove_bak.sh
find . -name '*.bak' -type f -print0 | xargs -0 -n1 bash -c 'echo "mv \"$0\" ~/\".Trash/`basename \"$0\"`"\"' | sh
You can’t perform that action at this time.