Skip to content

Instantly share code, notes, and snippets.

View abhikhatri's full-sized avatar
💭
I may be slow to respond.

Abhi Khatri abhikhatri

💭
I may be slow to respond.
View GitHub Profile
@abhikhatri
abhikhatri / bash.sh
Created September 2, 2022 21:39 — forked from wikiti/bash.sh
Backup and restore in PostgreSQL using compressed backups.
# List databases
sudo su postgres
psql
\list
# Create a compressed backup
sudo su postgres
pg_dump -Fc <database_name> > <file>
# Example
@abhikhatri
abhikhatri / dump-restore
Created July 29, 2020 12:43 — forked from ricjcosme/dump-restore
DUMP / RESTORE PostgreSQL Kubernetes
DUMP
// pod-name name of the postgres pod
// postgres-user database user that is able to access the database
// database-name name of the database
kubectl exec [pod-name] -- bash -c "pg_dump -U [postgres-user] [database-name]" > database.sql
RESTORE
// pod-name name of the postgres pod
// postgres-user database user that is able to access the database
// database-name name of the database
@abhikhatri
abhikhatri / deployUser.md
Created December 11, 2019 05:51 — forked from learncodeacademy/deployUser.md
Adding a deploy user in Linux

(wherever it says url.com, use your server's domain or IP)

Login to new server as root, then add a deploy user

sudo useradd --create-home -s /bin/bash deploy
sudo adduser deploy sudo
sudo passwd deploy

And Update the new password

@abhikhatri
abhikhatri / client.js
Created August 23, 2016 12:47 — forked from crtr0/client.js
A simple example of setting-up dynamic "rooms" for socket.io clients to join
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
@abhikhatri
abhikhatri / bootstrap-3-carousel-keyboard.js
Created December 10, 2015 05:27 — forked from dylanvalade/bootstrap-3-carousel-keyboard.js
Bootstrap carousel keyboard event controls for next and previous slides.
browser-sync start --server --directory true --files "**/*.css, **/*.js, **/*.html"