Skip to content

Instantly share code, notes, and snippets.

View ThomasTJdev's full-sized avatar

Thomas T. Jarløv ThomasTJdev

View GitHub Profile
@ThomasTJdev
ThomasTJdev / postgres_queries_and_commands.md
Last active November 16, 2022 09:30 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands

Postgres help

Active connections

SELECT * FROM pg_stat_activity;

SELECT pg_terminate_backend(pid)
    FROM pg_stat_activity
@ThomasTJdev
ThomasTJdev / how-to-copy-aws-rds-to-local.md
Created August 15, 2019 10:13 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@ThomasTJdev
ThomasTJdev / summernote-ext-checkbox.js
Last active October 30, 2018 19:10 — forked from onesimoh/summernote-ext-checkbox.js
Summernote 0.8.10 plugin for checkbox using Bootstrap 4 with Font Awesome 4
(function (factory) {
/* global define */
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals