Skip to content

Instantly share code, notes, and snippets.

harveyconnor /
Last active May 4, 2021
MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to for helping with their docker-compose file!

asoorm / docker-compose-mongo-replicaset.yml
Created Sep 14, 2018
Mongo Replica Set docker compose
View docker-compose-mongo-replicaset.yml
version: "3"
hostname: mongo1
container_name: localmongo1
image: mongo:4.0-xenial
- 27017
- 27011:27017
posemon /
Created May 23, 2018
Postman install Ubuntu 18.04
# Get postman app
wget -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/bin/postman
#Create a Desktop Entry
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
xameeramir / default nginx configuration file
Last active May 4, 2021
The default nginx configuration file inside /etc/nginx/sites-available/default
View default nginx configuration file
## Personal note: Muslims are not terrorists and I humbly request my engineering community to help end racism.
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
micc83 / mysqldump.php
Created Jun 5, 2017
Simple PHP script to dump a MySql database
View mysqldump.php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
$database = 'db';
$user = 'user';
$pass = 'pass';
$host = 'localhost';
judy2k / parse_dotenv.bash
Created Mar 22, 2017
Parse a .env (dotenv) file directly using BASH
View parse_dotenv.bash
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
craigvantonder /
Last active Feb 3, 2021
Flushing the DNS in Ubuntu 16.04
# NB: First install nscd with sudo apt-get install nscd
# run this command to flush dns cache:
sudo /etc/init.d/dns-clean restart
# or use:
sudo /etc/init.d/networking force-reload
# Flush nscd dns cache:
sudo /etc/init.d/nscd restart
nathanielove /
Created Nov 1, 2016
How to setup Shadowsocks on your Ubuntu server

How to setup Shadowsocks on your Ubuntu server

Your school or company network may block the access to a few specific websites. To solve this problem, I'd highly recommend Shadowsocks, since it is the easiest proxy tool I've ever found, and it's FREE (of course iff you have your own server running).

First, ssh to your server, and make sure you have Python and pip installed. If you have Python but not pip, install it using the following command

$ sudo apt-get install python3-pip
sam-artuso /
Last active Apr 21, 2021
Setting up Babel and nodemon

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y
amirasaran / Arabic character to Persian (Farsi) - PHP
Last active Jan 30, 2021
convert Arabic character to Persian (Farsi) - PHP
View Arabic character to Persian (Farsi) - PHP
public static function arabicToPersian($string)
$characters = [
'ك' => 'ک',
'دِ' => 'د',
'بِ' => 'ب',
'زِ' => 'ز',
'ذِ' => 'ذ',
'شِ' => 'ش',