pg_dumpall -U postgres -s > schema_all.sql
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public \
sudo zpool status
output:
pool: raid10_pool
state: ONLINE
## show pool configs | |
zfs get all zfs10 | |
## print arc summary | |
arc_summary | |
## watch arc stats every 2 sec | |
watch -n 2 grep arc /proc/spl/kstat/zfs/arcstats | |
## test write speed |
CREATE FUNCTION public.on_create_table_funct() | |
RETURNS event_trigger | |
LANGUAGE 'plpgsql' | |
COST 100 | |
VOLATILE NOT LEAKPROOF SECURITY DEFINER | |
AS $BODY$ | |
DECLARE | |
sch text; | |
BEGIN |
#/bin/bash | |
set -e | |
# set your BOT's API KEY and TOKEN | |
API_KEY=****************************** | |
API_TOKEN=**************************** | |
## send notification to google chat with card format. | |
# | |
# sample: |
-- https://stackoverflow.com/questions/26279770/how-to-cast-ctid-system-column-into-long-and-vice-versa | |
-- ctid to long | |
SELECT ((ctid::text::point)[0]::bigint << 32) | (ctid::text::point)[1]::bigint AS long_ctid FROM table1 LIMIT 1; | |
long_ctid | |
----------------- | |
130043019788289 | |
(1 row) |
# start a Xserver | |
sudo X -config xorg.conf | |
# set fan speed to 60% | |
sudo DISPLAY=:0 nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=60" |
#!/bin/bash | |
set -e | |
set -o pipefail | |
# https://gist.github.com/kilfu0701/2f545f7f1a8a9d0bd923be8d38028817 | |
function echo_c() | |
{ | |
WHITE='\033[1;37m' | |
RED='\033[1;31m' | |
GREEN='\033[1;32m' |
CREATE OR REPLACE FUNCTION rm_table_idx(tbl_name text) | |
RETURNS void AS | |
$$ | |
DECLARE | |
_sql text; | |
BEGIN | |
SELECT 'DROP INDEX ' || string_agg(indexrelid::regclass::text, ', ') | |
FROM pg_index i | |
LEFT JOIN pg_depend d ON d.objid = i.indexrelid |
FROM python:3.8 | |
USER root | |
RUN apt-get update | |
RUN apt-get -y install locales && \ | |
localedef -f UTF-8 -i ja_JP ja_JP.UTF-8 | |
ENV LANG ja_JP.UTF-8 | |
ENV LANGUAGE ja_JP:ja | |
ENV LC_ALL ja_JP.UTF-8 |