Skip to content

Instantly share code, notes, and snippets.

View daothanh's full-sized avatar

Thanh daothanh

  • Webvi Viet Nam
  • Hanoi, Vietnam
View GitHub Profile

Keybase proof

I hereby claim:

  • I am daothanh on github.
  • I am thanhdx (https://keybase.io/thanhdx) on keybase.
  • I have a public key whose fingerprint is 659D 608F D706 6578 FF16 24E4 AA35 24E7 A1A3 A23E

To claim this, I am signing this object:

@daothanh
daothanh / signal.js
Created July 6, 2016 08:22
Tokbox signal
function signalEventHandler(event) {
if (event.type == "signal:begincall") {
//***************************Call Begin*********************************//
data = event.data.streamId.toString().split('|');
_streamId = data[0];
_name = data[1];
state = 'begincall';
hide('btn_'+_streamId);
//document.getElementById('acceptCallBox').style.display = 'block';
//document.getElementById('acceptCallLabel').innerHTML = 'Có cuộc gọi đến từ ' + _name;
@daothanh
daothanh / send_signal.js
Created July 6, 2016 08:27
Cach gui signal cuoc goi
//Gui signal begin call
session.signal({
type: "begincall",
to: _stream.connection,
data: {
streamId: _selfstream.streamId + "|" + _selfstream.name
}
}, function(error) {
if (error) {
console.log("signal error: " + error.reason);
@daothanh
daothanh / install-comodo-ssl-cert-for-nginx.rst
Created July 1, 2017 03:28 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@daothanh
daothanh / .htaccess
Created July 7, 2017 12:18
laravel shared hosting .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
@daothanh
daothanh / Default (Linux).sublime-mousemap
Created August 24, 2017 13:44
sublime text 3 packages for php developer
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
"command": "goto_definition"
}
]
@daothanh
daothanh / multiple-php-versions-on-ubuntu-16.04.md
Created September 16, 2017 06:48 — forked from aaronbloomfield/multiple-php-versions-on-ubuntu-16.04.md
Running multiple PHP versions on Apache2 and Ubuntu 16.04

Setting up multiple apache2 instances on Ubuntu 16.04

PHP handling on apache is done via modules of one sort or another, and running multiple version is problematic on a single instance. The solution is to run two instances of apache on the same machine. This allows one instance to run PHP 7 (the default on 16.04), and another can run PHP 5. Since normal http/https is on ports 80 and 443, the second instance will run on ports 81 and 444. Since it is running on the same machine, all file system and database access is the exact same.

All the commands herein have to be run as root, or with sudo prefixed to the command.

  1. Read /usr/share/doc/apache2/README.multiple-instances

  2. Run sh ./setup-instance php5 from /usr/share/doc/apache2/examples, where php5 is the suffix for the second site; all commands for the second site will have that suffix. This will keep all of the same configuration for all sites on the new instance, including SSL certif

@daothanh
daothanh / satis_install.sh
Created December 2, 2017 06:07 — forked from h4cc/satis_install.sh
Guide to install a satis server for composer. It can mirror packages and create a index for own packages.
# Install a Webserver
apt-get -y install apache2
# Target docroot to /home/satis/web/
# Install PHP5 CLI and needed programs.
apt-get -y install php5-cli php5-curl php5-json git wget
# Add a specifix user for our task
adduser satis
function buildUrl(url, parameters){
var query = window.location.search.substring(1), vars = query.split('&'), qs = "";
if (vars.length) {
for(var j in vars) {
if (vars[j] !== "") {
var value = vars[j].split("=");
if (parameters.hasOwnProperty(value[0]) === false) {
parameters[value[0]] = value[1];
}
}
{
"aps":{
"senderName":"Ph\u00f2ng kh\u00e1m EasyCar",
"alert":"C\u00f3 cu\u1ed9c g\u1ecdi \u0111\u1ebfn t\u1eeb Ph\u00f2ng kh\u00e1m EasyCare",
"sound":"default",
"content-available":"1"
},
"pushData":{
"room":"je",
"token":"T1==cGFydG5lcl9pZD00NjA0NzAxMiZzaWc9NjQxNDYyMWRjNDk2ODYyMzUyZjc0ZDIxOWE1N2ExOTEzNGFiMmE3NjpzZXNzaW9uX2lkPTJfTVg0ME5qQTBOekF4TW41LU1UVXlNRGt6TVRZME5EZ3dOWDQxVFdodU9VVllSM2N6WVhGd2NsbGxOWEZuUVM5UWRqUi1VSDQmY3JlYXRlX3RpbWU9MTUyMDkzMTY0NCZyb2xlPXB1Ymxpc2hlciZub25jZT0xNTIwOTMxNjQ0Ljg3NzgxMTYwNDE0OTU5JmV4cGlyZV90aW1lPTE1MjA5NDYwNDM=",