View jsoup_examples.java
import java.io.IOException; | |
import java.security.SecureRandom; | |
import java.security.cert.X509Certificate; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.List; | |
import java.util.Set; |
View pgsql_administration.sh
# dump of your database in plain text. It creates tables, views, etc | |
# for exporting multiple tables only, you can repeat parameter -t | |
pg_dump --host <IP> --port 5432 --username "myuser" \ | |
--format plain --create --encoding UTF8 -v \ | |
--file "/my/path/file.sql" "db_name" | |
# or, with short opts and wrapping all SQL statements inside a transaction with automatic ROLLBACK | |
psql -U postgres -p 5433 --single-transaction -f /my/path/file.sql db_name | |
# Import of a SQL dump. Be sure to have write permissions in the current directory |
View pgsql_cheatsheet.sql
-- QUERIES OPERATIONS | |
---------------------------------------------------------------------------------- | |
-- KILL ALL sessions FOR A DATABASE | |
SELECT pg_terminate_backend(pg_stat_activity.pid) | |
FROM pg_stat_activity | |
WHERE pg_stat_activity.datname = 'TARGET_DB' | |
AND pid <> pg_backend_pid(); | |
-- GETTING RUNNING QUERIES, version: 9.2+ |
NewerOlder