Skip to content

Instantly share code, notes, and snippets.

View anhnt's full-sized avatar
🏠
Working from home

Anh anhnt

🏠
Working from home
View GitHub Profile

NOTE -

  • Remove -h option if you are doing operation on same machine
  • Remove -u , -p option if your database don't have username and password

Binary

Import database

mongorestore -h IP:port -d DB_Name -u user_name -p password <input db directory>
@anhnt
anhnt / gist:2ba4705fe71895d124638afce75f67d3
Created April 9, 2018 10:15 — forked from craigminihan/gist:b23c06afd9073ec32e0c
Build GCC 4.9.2 for C/C++ on CentOS 7
sudo yum install libmpc-devel mpfr-devel gmp-devel
cd ~/Downloads
curl ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2 -O
tar xvfj gcc-4.9.2.tar.bz2
cd gcc-4.9.2
./configure --disable-multilib --enable-languages=c,c++
make -j 4
make install
@anhnt
anhnt / DKIM_SPF_Sendmail
Created January 25, 2018 17:14 — forked from artmouse/DKIM_SPF_Sendmail
DKIM + SPF + Sendmail for multiple domains (Ubuntu)
DKIM is DomainKeys Identified Mail and is used in mail servers, such as Postfix or Sendmail to sign e-mails and thus authenticating the sender so that a forgery can be detected. It also reduces the possibility of an e-mail being flagged as spam, but it's not a definite prevention.
A much simpler method is using SPF (Sender Policy Framework) which, in a nutshell, verifies the sender IP address.
According to the internet, using both should result to ????, PROFIT !!!.
SPF does not need a specific configuration. Whitelisted servers are listed in a DNS record, TXT or SPF, and an example record is:
example.com. IN TXT "v=spf1 a mx ~all"
@anhnt
anhnt / reset-wsl.sh
Created January 12, 2018 09:40 — forked from ishu3101/reset-wsl.sh
Resetting your Windows Subsystem for Linux (WSL) Environment
# Resetting your Windows Subsystem for Linux (WSL) Environment
lxrun.exe /uninstall /full
lxrun.exe /install
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@anhnt
anhnt / call-apply-bind-proxy.js
Created July 11, 2016 03:08 — forked from branneman/call-apply-bind-proxy.js
JavaScript call() vs apply() vs bind() vs $.proxy()
var fn = function(arg1, arg2) {
var str = '<p>aap ' + this.noot + ' ' + arg1 + ' ' + arg2 + '</p>';
document.body.innerHTML += str;
};
var context = {
'noot': 'noot'
};
var args = ['mies', 'wim'];
// Calls a function with a given 'this' value and arguments provided individually.
@anhnt
anhnt / instafeedjsaccess.md
Created June 14, 2016 07:27 — forked from mojaray2k/instafeedjsaccess.md
Getting Instagram Access Token for http://intafeedjs.com

#Use this URL to get your client authorized for Instafeed.JS plugin for Instagram.

  1. First login into your Instargam account
  2. Then go to https://www.instagram.com/developer/
  3. At the top click on the Button that says "Manage Clients".
  4. If you have not Register a new client.
  5. Fill out everything and where it says redirect url put this url: http://instafeedjs.com
  6. Then on the security tab make sure you uncheck "Disable implicit OAuth"
  7. Finally use this link to authoruize Instafeed. Where it says "[Client ID]" replace that including the brackets with your clientID from instagram:
  8. https://instagram.com/oauth/authorize/?client_id=[Client ID]&redirect_uri=http://instafeedjs.com&amp;response_type=token
@anhnt
anhnt / README.markdown
Created April 28, 2016 06:45 — forked from marijn/README.markdown
List of countries in YAML, CSV and TXT format

#List of countries

It's time someone compiled a list of countries to use within a web application. This gist attempts to make a first move at that.

List of nationalities

I've also compiled a list of nationalities

/**
* A simple example of how to use Waterline v0.10 with Express
*/
var express = require('express'),
_ = require('lodash'),
app = express(),
Waterline = require('waterline');
var truth = function() { return true; };
var relativeTruth = function() { return false; };
var assert = function(func) {
return func() == true;
};
var wrapper = function(func) {
// perform setup work here