Skip to content

Instantly share code, notes, and snippets.

View mamemomonga's full-sized avatar

Shotaro Takahashi mamemomonga

View GitHub Profile
@mamemomonga
mamemomonga / log-monitor.pl
Created May 14, 2020 15:09
コンテナの/app/log/production.logに特定文字列がでてきたらSlackCatをつかって通知する
#!/usr/bin/env perl
# -----------------
# コンテナの/app/log/production.logに特定文字列がでてきたらSlackCatをつかって通知する
# 実行 nohup ./log-monitor.pl &
# -----------------
use feature 'say';
use strict;
use warnings;
$|=1;
@mamemomonga
mamemomonga / example.sh
Last active May 5, 2020 11:38
汎用シェルスクリプト
#!/bin/bash
set -eu
# 実行ファイルのあるディレクトリ
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# 実行ファイルの一階層下のディレクトリ
# BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
# 実行可能コマンド
@mamemomonga
mamemomonga / login.sh
Created April 26, 2020 00:43
awscliスニペット集
#!/bin/bash
set -eu
# ECRにログイン
# Version2にはレポジトリパスが必要
ecr_login() {
local awscli_version="$( aws --version | perl -nlE 'say $1 if (m#aws-cli/(\d)\.#)' )"
case "$awscli_version" in
"1" )
aws ecr get-login --no-include-email --region ap-northeast-1 | sh
@mamemomonga
mamemomonga / Dockerfile
Created April 23, 2020 19:55
Dockerfileにnode.js組み込み(debian)
RUN set -xe && \
curl -Lo /tmp/node.tar.xz https://nodejs.org/dist/v12.16.2/node-v12.16.2-linux-x64.tar.xz && \
curl -Lo /tmp/yarn.tar.gz https://yarnpkg.com/latest.tar.gz && \
tar Jx --strip-components 1 -f /tmp/node.tar.xz -C /usr/local && \
tar zx --strip-components 1 -f /tmp/yarn.tar.gz -C /usr/local && \
rm /tmp/node.tar.xz && \
rm /tmp/yarn.tar.gz
@mamemomonga
mamemomonga / FoldingatHome.md
Last active April 2, 2020 01:05
Ubuntu/DebianにFolding@homeをインストールする方法

Ubuntu/DebianにFolding@homeをインストールする方法

あまりCPU負荷のかかってないVPSなどにいれて、ウィルスの解析に役立てましょう。

$ wget https://download.foldingathome.org/releases/public/release/fahclient/debian-stable-64bit/v7.5/fahclient_7.5.1_amd64.deb
$ sudo dpkg -i fahclient_7.5.1_amd64.deb

WebUIへの接続

SSHのポートフォワードを使うと便利です。

@mamemomonga
mamemomonga / dev.sh
Created March 31, 2020 22:28
EC2で接続されているネットワーク情報をインスタンス内で取得
#!/bin/bash
set -eu
get_meta_data() {
curl --retry 3 --silent --fail http://169.254.169.254/latest/meta-data/$1
}
PUB_MAC=$( get_meta_data mac )
for i in $( ls /sys/class/net ); do
if [ "$i" == "lo" ]; then continue; fi
@mamemomonga
mamemomonga / MicrosoftTeam.md
Created March 31, 2020 06:46
迷惑アプリMicrosoft Teamを消す方法

Microsoft Teamを消す方法

アプリと機能から

  • Microsoft Teams
  • Teams Machine-Wide Installer

をアンインストール

@mamemomonga
mamemomonga / next.md
Created March 20, 2020 08:08
Next.js 事始め
@mamemomonga
mamemomonga / vue.md
Created March 20, 2020 06:06
Vue.js 事始め

Vue.js 事始め

$ mkdir vueapp && cd vueapp

$ cat > .gitignore << 'EOS'
node_modules
*.swp
EOS

$ yarn init -y
@mamemomonga
mamemomonga / ESP-WROOM-02-flash-size.md
Created March 16, 2020 07:55
ESP-WROOM-02 のフラッシュメモリサイズを確認する方法

ESP-WROOM-02 のフラッシュメモリサイズを確認する方法

Programmingモードにして実行する

$ pip install esptool
$ ~/.local/bin/esptool.py --port /dev/ttyUSB0 flash_id
esptool.py v2.8
Serial port /dev/ttyUSB0
Connecting........
Detecting chip type... ESP8266