Skip to content

Instantly share code, notes, and snippets.

cat > Dockerfile <<EOF
# 上位イメージとして正式な Node ランタイムを使用します
FROM node:6
# コンテナの作業ディレクトリを /app に設定します
WORKDIR /app
# 現行ディレクトリの内容を /app のコンテナにコピーします
ADD . /app
# コンテナのポート 80 で外部からアクセスできるようにします
EXPOSE 80
# コンテナの起動時に node を使用して app.js を実行します
-- SHOWQ command to check all parameters or just one
SHOW ALL;
SHOW max_connection;
SHOW config_file;
-- Pattern searchable
\x
SELECT
#build
docker build -t {image_name} .
docker-compose build
docker-compose build --no-cache
#run
docker-compose up -d #background
# or
docker ps
#only check auto vacuum
select n_live_tup,n_dead_tup,relname,last_autovacuum,last_autoanalyze,autovacuum_count,autoanalyze_count from pg_stat_all_tables where schemaname = 'hogehoge';
while true; date "+%Y%m%d-%H:%M:%S" | tr '\n' ' '; do netstat -ant | grep -c "5432.*ESTABLISHED"; sleep 5s; done;
while true; date "+%Y%m%d-%H:%M:%S"; do ~/redis-stable/src/redis-cli -h redis-endpoint -p 6379 info; sleep 5s; done;
cat tablelist.txt | while read line; do line=`echo ${line} | sed -e "s/[\r\n]\+//g"`; echo 'SELECT '"'${line}'"' AS TableName, COUNT(*) FROM '${line}' UNION ALL' >> select.sql; done
@ny1030
ny1030 / display-duplicate-rows.sh
Last active May 16, 2020 07:14
- This command for Mac-OS. If this command use in Linux. Replacae `gawk` to `awk`. - if display non-duplicate rows: please replace `seen[$0]++` to `!seen[$0]++`
gawk -F, 'BEGIN{OFS=","}{print $2,$4,$8,$9}' {filename} | gawk 'seen[$0]++'