Skip to content

Instantly share code, notes, and snippets.

View oanhnn's full-sized avatar
🇻🇳

Oanh Nguyen oanhnn

🇻🇳
View GitHub Profile
@oanhnn
oanhnn / bash-cheatsheet.sh
Created May 31, 2017 01:40 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@oanhnn
oanhnn / how_to.md
Created May 14, 2017 16:47
How to fix composer error "Content-Length Mismatch"

First, run:

$ composer config --list --global        //this will get the composer home path.
[home] /root/.composer                   //it's my composer home path.

And then, edit the config.json in [home] directory, make it like this:

{
  "config": {
 "github-protocols": [
@oanhnn
oanhnn / install-comodo-ssl-cert-for-nginx.rst
Created May 5, 2017 04:58 — 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

@oanhnn
oanhnn / vagrant.org
Created May 16, 2016 02:19 — forked from akiatoji/vagrant.org
CentOS 6.2 Box for Vagrant

Installing CentOS

Download net install iso: CentOS-6.2-x86_64-netinstall.iso

Create a new VirtualBox machine

  • Name: vagrant-centos
  • Operating System: Linux
  • Version: Red Hat
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 6, 2024 21:40
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@oanhnn
oanhnn / index.html
Created December 1, 2015 04:05
Launch app from web page snippets
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div style="width:0; height:0; overflow:hidden;">
<iframe id="launch_frame" name="launch_frame"></iframe>
@oanhnn
oanhnn / test_performance_determine_content_type.php
Created November 12, 2015 03:53
Test performance of three determine content type methods
<?php
class A
{
protected $knownTypes = [
'application/json' => true,
'application/xml' => true,
'text/xml' => true,
'text/html' => true,
];
@oanhnn
oanhnn / gource.sh
Created July 29, 2015 02:47
Script mark gource video for git project
# install git and gource
# get a branch of git
# create gource video
$ sudo apt-get install bzr gource
$ git clone git@github.com:oanhnn/slim-skeleton.git project_dir
$ cd project_dir
$ git checkout master
$ gource \
@oanhnn
oanhnn / VD1.html
Last active August 29, 2015 14:22
CSS center block
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.container-block {
display: block;
position: relative;
background: #ccc; /* For visualization */
width: 500px; /* Changeable */
height: 500px; /* Changeable */
@oanhnn
oanhnn / strtotime
Created May 11, 2015 03:57
Note for using strtotime function in PHP
<?php
/**
* Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components:
* if the separator is a slash (/), then the American m/d/y is assumed;
* whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.
*/
strtotime('12/25/2014');
strtotime('25-12-2014');