This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create table deps_saved_ddl | |
| ( | |
| deps_id serial primary key, | |
| deps_view_schema varchar(255), | |
| deps_view_name varchar(255), | |
| deps_ddl_to_run text | |
| ); | |
| create or replace function deps_save_and_drop_dependencies(p_view_schema varchar, p_view_name varchar) returns void as | |
| $$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE OR REPLACE FUNCTION generate_object_id() RETURNS varchar AS $$ | |
| DECLARE | |
| time_component bigint; | |
| machine_id int := FLOOR(random() * 16777215); | |
| process_id int; | |
| seq_id bigint := FLOOR(random() * 16777215); | |
| result varchar:= ''; | |
| BEGIN | |
| SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp())) INTO time_component; | |
| SELECT pg_backend_pid() INTO process_id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| pass=`LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | dd bs=100 count=1 2>/dev/null | head -c 16` | |
| echo $pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(query_start, clock_timestamp()), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "time" | |
| ) | |
| // Example SSE server in Golang. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| BACKUP_DIR=${HOME}'/pgbackup/' | |
| DATE=`date +'%Y-%m-%d_%H-%M'` | |
| for d in `psql postgres -c 'select datname from pg_database' -t`; | |
| do | |
| BACKUP_FILE=${BACKUP_DIR}${d}_${DATE}.dump | |
| pg_dump -f ${BACKUP_FILE} --format=d -j 4 -v -x -O --compress=7 ${d} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pg_dump -f dbname-2015-12-27.dump --format=d -j 4 -v -x -O --compress=7 dbname | |
| tar -zcvf dbname-2015-12-27.dump.tar dbname-2015-12-27.dump/ | |
| pg_restore -d dbname_test_backup dbname-2015-12-27.dump -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ----------------------------------------- | |
| -- psqlrc file to set psql preferences -- | |
| -- Author : Prashanth Goriparthi -- | |
| ----------------------------------------- | |
| -- source : https://opensourcedbms.com/dbms/psqlrc-psql-startup-file-for-postgres/ | |
| \set QUIET ON | |
| \set PROMPT1 '%[%033[1;32;40m%]%M:%> %n@%/%[%033[0m%]% # ' | |
| \set PAGER OFF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Generate SSL certificate | |
| #Source http://greengeckodesign.com:8880/blog/2013/06/15/creating-an-ssl-certificate-for-node-dot-js/ | |
| openssl genrsa -des3 -out ca.key 1024 | |
| openssl req -new -key ca.key -out ca.csr | |
| openssl x509 -req -days 365 -in ca.csr -out ca.crt -signkey ca.key | |
| openssl genrsa -des3 -out server.key 1024 | |
| openssl req -new -key server.key -out server.csr | |
| cp server.key server.key.org | |
| openssl rsa -in server.key.org -out server.key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Включить рацию при нажайтой F, затем в F4 ввести код: | |
| 400-470 МГц - 6029 | |
| 136-174 МГц - 6018 |