Skip to content

Instantly share code, notes, and snippets.

View shahidcodes's full-sized avatar

Shahid Kamal shahidcodes

View GitHub Profile
@shahidcodes
shahidcodes / README.md
Last active January 6, 2025 17:19
Create ubuntu user and disable root login

RUN this first as root

curl -s https://gist.githubusercontent.com/shahidcodes/218a5c1331b87b45235a52a2b2382c46/raw/ea6b22452282aa5a1fd70c9fa7df393e89107e03/create-ubuntu-user.sh | sudo bash

Login using ubuntu user

Then run this as ubuntu user

# -*- coding: utf-8 -*-
#VERSION: 1.2
#AUTHORS: Joost Bremmer ([email protected])
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@shahidcodes
shahidcodes / 40-rabbana-duas.json
Created October 11, 2023 09:27
40 Rabbana Duas
[
{
"header": "",
"arabic-text": "رَبَّنَا تَقَبَّلۡ مِنَّآۖ إِنَّكَ أَنتَ ٱلسَّمِيعُ ٱلۡعَلِيمُ",
"transliteration": "Rabbana taqabbal minnaa innaka Antas Samee’ul Aleem",
"translation": "Rabbana taqabbal minnaa innaka Antas Samee’ul Aleem“Our Lord, accept [this] from us. Indeed You are the Hearing, the Knowing.”– 2:127 –",
"recommended use": "You can recite this du’a whenever you would like for Allah (swt) to accept whatever good you’ve just done. Du’a Prophet Ibrahim (as) recited after building the kaaba with his son."
},
{
"header": "Rabbana Dua #2",
@shahidcodes
shahidcodes / mongo-backup-script.sh
Created January 11, 2023 16:00
Bash script to create mongodb backup and upload to s3
#!/bin/bash
ADMIN_DB_URI="mongodb://backupuser:backupuser@localhost:27017/admin?authSource=admin"
MONGODUMP_PATH="/usr/bin/mongodump"
S3_BUCKET_NAME="dbbackups" #replace with your bucket name on Amazon S3
S3_BUCKET_PATH="backups"
#Force file syncronization and lock writes
mongosh $ADMIN_DB_URI --eval "printjson(db.fsyncLock())"
@shahidcodes
shahidcodes / stress.js
Created June 28, 2022 15:53
Socket.io benchmark
const io = require("socket.io-client");
const createLogger =
(index) =>
(...rest) =>
console.log(`[${index}]`, ...rest);
const token = "";
const url = "";
let result = {
@shahidcodes
shahidcodes / allowlist.txt
Last active May 14, 2022 05:18
Adguard.list
*.getdrip.com
getdrip.com
t.co
@shahidcodes
shahidcodes / set-route.sh
Last active March 27, 2022 10:24
Use vpn for specific subnets on MacOS
#!/bin/sh
# Stackoverflow - https://superuser.com/a/1111215
sudo route delete -net default -interface ppp0
sudo route add -net 0.0.0.0 -interface en0
sudo route add -net 172.17.0.0 -netmask 255.255.0.0 -interface ppp0
sudo route add -net 115.84.158.0 -netmask 255.255.255.0 -interface ppp0
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
@shahidcodes
shahidcodes / generate.js
Created February 25, 2022 05:24
Generate two alphabet continous sequences till `ZZ`
let startCharCode = 64
const letters = [
'A', 'B', 'C', 'D', 'E', 'F',
'G', 'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z'
]
@shahidcodes
shahidcodes / 1000.json
Created December 11, 2021 08:50
1000 points.
[[889,382],[550,23],[801,552],[332,71],[838,848],[306,9],[28,130],[571,745],[971,739],[411,304],[878,659],[796,57],[854,22],[97,927],[261,878],[894,67],[849,904],[502,638],[220,345],[703,593],[338,199],[292,308],[581,592],[383,537],[280,296],[828,839],[910,929],[166,105],[628,13],[939,103],[96,418],[699,9],[915,958],[963,370],[21,573],[836,12],[63,118],[519,351],[762,503],[50,408],[519,714],[893,908],[752,991],[139,353],[300,991],[231,35],[824,968],[873,475],[555,553],[239,953],[880,980],[351,760],[749,514],[999,26],[212,890],[281,928],[67,914],[409,629],[282,836],[479,157],[157,677],[6,613],[432,567],[630,118],[304,488],[783,638],[112,135],[565,141],[51,688],[129,31],[905,625],[765,875],[446,102],[985,283],[350,504],[993,475],[128,23],[249,851],[893,51],[716,227],[782,686],[663,727],[382,630],[147,492],[112,945],[912,379],[394,460],[624,100],[34,367],[877,259],[678,29],[37,131],[802,757],[68,379],[96,396],[699,957],[25,417],[2,692],[81,530],[277,275],[816,895],[448,828],[48,784],[977,357],[215,352],[122,73],