Skip to content

Instantly share code, notes, and snippets.

View shahanahmed86's full-sized avatar

Shahan Ahmed Khan shahanahmed86

  • Karachi
  • 05:19 (UTC +05:00)
View GitHub Profile
@shahanahmed86
shahanahmed86 / gpg-key-migration.md
Created October 4, 2024 12:39 — forked from angela-d/gpg-key-migration.md
Move GPG Keys from One Machine to Another

Migrate GPG Keys from One Workstation to Another

Replace [your key] with your key ID

To obtain your key ID

gpg --list-secret-keys --keyid-format LONG

Which returns something like

@shahanahmed86
shahanahmed86 / nvmCommands.js
Created July 18, 2024 14:46 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@shahanahmed86
shahanahmed86 / fixing-broken-event-emitter.ts
Created July 5, 2024 19:53
Fixing Broken Event Emitter in Typescript
type Listener<T extends Array<any>> = (...args: T) => void;
class EventEmitter<EventMap extends Record<string, Array<any>>> {
private listeners: { [K in keyof EventMap]?: Set<Listener<EventMap[K]>>} = {};
private getListeners<K extends keyof EventMap>(eventName: K): Set<Listener<EventMap[K]>> {
return this.listeners[eventName] ?? new Set();
}
on<K extends keyof EventMap>(eventName: K, listener: Listener<EventMap[K]>) {
@shahanahmed86
shahanahmed86 / psql-docker.sh
Created August 7, 2023 12:26
Backup and restore a postgres database from a running Docker container
# Backup
docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
# Restore
cat your_dump.sql | docker exec -i your-db-container psql -U postgres
name: ci-cd pipeline deploy to prod
on:
push:
branches: [ feature/github-action ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Get Github action IP
Upload files to Google Drive using Google Apps Script Web Apps and save records in Google Sheets.
@shahanahmed86
shahanahmed86 / mysql-docker.sh
Created August 15, 2022 19:47 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@shahanahmed86
shahanahmed86 / react-native-ubuntu-20.04.md
Created May 19, 2022 13:31 — forked from JuniYadi/react-native-ubuntu-20.04.md
Install React Native in Ubuntu 20.04

Install React Native in Ubuntu 20.04

1. Install NodeJS

  • For Development Purpose using NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
@shahanahmed86
shahanahmed86 / node_nginx_ssl.md
Last active November 26, 2021 05:43 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@shahanahmed86
shahanahmed86 / oracle.md
Last active October 16, 2024 10:46
install oracle 11g database in ubuntu

Step 1: Download Oracle Database Express Edition.

http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html

Step 2: Instructions before install Oracle

1. Copy the downloaded file and paste it in home directory.

2. Unzip using the command:

unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip