Skip to content

Instantly share code, notes, and snippets.

View masuidrive's full-sized avatar

Yuichiro MASUI masuidrive

View GitHub Profile
@masuidrive
masuidrive / gist:408e1991912f5166bbecef0860b68a9c
Created June 25, 2022 14:51
Arduino audio-tools settings for M5Stack Core2
// https://github.com/pschatzmann/arduino-audio-tools/ settings for M5Stack Core2
// Audio settings
const int sample_rate = 44100;
const int channels = 1;
// Speaker settings
I2SStream out;
auto config = out.defaultConfig(TX_MODE);
config.sample_rate = sample_rate;
@masuidrive
masuidrive / Install-FreeRTOS-dev-env-on-m1-mac.sh
Created April 29, 2021 15:07
M1 Mac環境でAmazon FreeRTOS on ESP32のビルドを行う
#/bin/sh
# M1 Mac環境でAmazon FreeRTOS on ESP32のビルドを行う
# FreeRTOSのソースはAWSコンソールのzipから落とさないで、
# https://github.com/aws/amazon-freertos から持ってくること
# 参考:
# https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_espressif.html#setup-espressif-idf42
# https://github.com/SeanMollet/esp-idf/tree/esp-2020r3-aarch64
#
# ビルドは下記のコマンドで
# idf.py -DVENDOR=espressif -DBOARD=esp32_wrover_kit -DCOMPILER=xtensa-esp32 build
@masuidrive
masuidrive / translate_slack_bot.js
Last active April 29, 2020 14:43
Slack用Google翻訳Bot on Firebase Functions
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 October 8, 2019 05:30
Docker, NodeとRubyの開発環境作り
#!/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 October 8, 2019 00:25
mydnsのLet's Encryptを設定するスクリプト
#!/bin/bash
# Usage:
# GROUP=1003 MYDNSJP_DOMAIN=XXXX.mydns.jp MYDNSJP_MASTERID=mydnsXXXXX MYDNSJP_MASTERPWD=XXXX [email protected] 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 December 5, 2019 08:18
Install code-server on Coder
#!/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 October 2, 2019 13:43
Install SoftEther server to Ubuntu
#!/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 October 7, 2019 14:44
SoftEtherの初期設定を行う
#!/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}"
'Aichi': '愛知県',
'Akita': '秋田県',
'Aomori': '青森県',
'Chiba': '千葉県',
'Ehime': '愛媛県',
'Fukui': '福井県',
'Fukuoka': '福岡県',
'Fukushima': '福島県',
'Gifu': '岐阜県',
'Gunma': '群馬県',
@masuidrive
masuidrive / rails-auth0.patch
Last active September 12, 2019 00:41
curl -L THIS | patch -p1でRailsにAuth0をインストールする https://auth0.com/docs/quickstart/webapp/rails/01-login
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