Skip to content

Instantly share code, notes, and snippets.

@muhammad-alqabbani
muhammad-alqabbani / clear-images.sh
Created December 27, 2022 16:51 — forked from GhazanfarMir/clear-images.sh
Single shell script to remove all containers, images and volumes used by containers. The script first tries to stop containers if there is any running, then remove the containers, followed by images removal and finally the container volumes.
#!/bin/bash
###########################################
#
# Simple Shell script to clean/remove all container/images
#
# The script will
# - first stop all running containers (if any),
# - remove containers
# - remove images
# - remove volumes
@muhammad-alqabbani
muhammad-alqabbani / restart.sh
Created March 29, 2021 12:42 — forked from mattheworiordan/restart.sh
Heroku scheduled restarts
#!/bin/sh
# Set up the Heroku scheduler to run this command every hour. See example setup at https://goo.gl/nMCSH3
#
# Requires env vars to be set in Heroku with `heroku config:set`:
# - HEROKU_APP_NAME: this is just the app name in Heroku, i.e. `heroku apps` will list all apps you have access to
# - HEROKU_CLI_USER: Once Heroku CLI is authenticated (https://goo.gl/Qypr4x), check `cat .netrc` (or `_netrc` on Windows),
# look for `login` under `machine api.heroku.com`
# - HEROKU_CLI_TOKEN: As above, but use the `password` field
#
@muhammad-alqabbani
muhammad-alqabbani / make-chr.sh
Created December 14, 2020 22:53 — forked from stroebs/make-chr.sh
Install Mikrotik CHR on a Digital Ocean droplet (Ubuntu 16.04.6 tested working 31/08/2019)
#!/bin/bash
#
# Digital Ocean Ubuntu 16.04.6 Droplet
# Running:
# wget https://gist.github.com/stroebs/54fc09734a3911e91eeeb43434f117df/raw/1ede2fb162d404171122db0c84a9eeea468a92cd/make-chr.sh
# chmod +x make-chr.sh
# ./make-chr.sh
#
wget http://download2.mikrotik.com/routeros/6.37/chr-6.37.img.zip -O chr.img.zip && \
gunzip -c chr.img.zip > chr.img && \
@muhammad-alqabbani
muhammad-alqabbani / explode-opvn.sh
Created December 5, 2020 23:07 — forked from dleonard00/explode-opvn.sh
extract the certificate and key from an .ovpn file
#!/bin/bash
# This script will extract the certificate and key from an .ovpn file
# into their own files, which makes it possible to use them to configure
# the VPN using Ubuntu's network manager
# Usage example:
# >> ovpnconvert username.dev.ovpn
# You can keep following these instructions here:
@muhammad-alqabbani
muhammad-alqabbani / .htaccess
Created December 2, 2020 23:48 — forked from ivandoric/.htaccess
.htaccess file for video tutorial about deploying Node apps to shared hosting. Checkout the video: https://www.youtube.com/watch?v=ebWJbbUT4TA
RewriteEngine On
RewriteRule ^$ http://127.0.0.1:8080/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:1337/$1 [P,L]
@muhammad-alqabbani
muhammad-alqabbani / main.txt
Created July 12, 2020 19:41 — forked from git-ff/main.txt
Delete duplicates mongo
// https://www.compose.com/articles/finding-duplicate-documents-in-mongodb/
db.hotels.aggregate([{ $group: { _id: { hid: "$hid" }, uniqueIds: { $addToSet: "$_id" }, count: {$sum: 1} } }, {$match: {count: {"$gt": 1}}}, {$sort: {count: -1}} ]).forEach(function(doc){ db.hotels.remove({ _id: doc.uniqueIds[1] }) });
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.