Skip to content

Instantly share code, notes, and snippets.

View hoangthienan's full-sized avatar

An hoangthienan

  • Ho Chi Minh City
View GitHub Profile

foobar, foo, bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud

@hoangthienan
hoangthienan / DNS.md
Last active July 31, 2019 18:55
Change DNS from Command Line of macOS

How to Set DNS Servers from the Command Line of macOS with networksetup

For example, to set a Mac with wi-fi to Google DNS of 8.8.8.8 the syntax would be:

networksetup -setdnsservers Wi-Fi 8.8.8.8

You can set multiple DNS servers if desired,

networksetup -setdnsservers Wi-Fi 208.67.222.222 208.67.220.220 8.8.8.8
@hoangthienan
hoangthienan / SSLExcludeCipherConnectionHelper.java
Created August 1, 2016 08:57
Here is my solution (java 1.6) removing TLS_DHE_ ciphers completely
package com.vht.sms.content.util;
import java.io.*;
import java.net.*;
import java.security.KeyStore;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@hoangthienan
hoangthienan / gjslint.ini
Last active August 29, 2015 14:11
Google-Closure-Linter JetBrains PhpStorm Integration
--strict
--ignore_errors=1,2,6,110,131,233
--jsdoc
--summary
--beep
--check_html
--nomultiprocess
--debug_indentation
--time
@hoangthienan
hoangthienan / redmine
Last active August 29, 2015 14:05
redmine
# Install Redmine on CentOS 6.5
# I don't install redmine via command : yum install redmine.
# Redmine supports Ruby 1.x so do not install ruby 2.0.
Install gem and passenger dependencies
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel libyaml-devel
Get Ruby
# Create the directory where you will store the Downloads
mkdir ~/Downloads # This can be any directory.
@hoangthienan
hoangthienan / elasticsearch
Last active September 10, 2018 14:42
Install ElasticSearch on CentOS 6.5
# install missing libraries (if any)
[root@sm ~]# cd ~
[root@sm ~]# sudo yum update
# get and unpack elasticsearch tar file
[root@sm ~]# wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.1.tar.gz -O elasticsearch.tar.gz
[root@sm ~]# tar -xvf elasticsearch.tar.gz
[root@sm ~]# mv elasticsearch-* elasticsearch
[root@sm ~]# sudo mv elasticsearch /usr/local/share
@hoangthienan
hoangthienan / mongodb
Created August 5, 2014 08:59
[Mongo] Backup & Restore
--backup
[root@sm ~]# mongodump -d smprocdb -o ./mongodump
[root@sm ~]# cd mongodump
[root@sm mongodump]# tar -zcf smprocdb.tar.gz smprocdb
--restore
[root@sm mongodump]# tar -xvf smprocdb.tar.gz ./smprocdb
[root@sm mongodump]# mongorestore -d smprocdb --drop ./smprocdb
--windows
@hoangthienan
hoangthienan / wkhtmltopdf
Created July 28, 2014 06:40
Install wkhtmltopdf on Centos 6 x64
$ wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-centos6-amd64.rpm
$ rpm -ivh wkhtmltox-0.12.1_linux-centos6-amd64.rpm
$ which wkhtmltopdf
/usr/local/bin/wkhtmltopdf