Skip to content

Instantly share code, notes, and snippets.

@vietlq
vietlq / Git push deployment in 7 easy steps.md
Created November 4, 2016 11:50 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@vietlq
vietlq / po2js.php
Created November 4, 2016 16:47 — forked from voduytuan/po2js.php
<?php
/**
* Download from: https://code.google.com/archive/p/php-po-parser/source/default/source
*/
include('./libs/POParser.php');
/**
* Example config.json
{
@vietlq
vietlq / letsencrypt.md
Created November 9, 2016 15:10 — forked from xrstf/letsencrypt.md
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@vietlq
vietlq / turtle-xyz-square-puzzle.py
Last active May 1, 2019 16:26
Answer to the puzzle of a square and 3 angles
import turtle, math
def p_line(t, n, length, angle):
"""Draws n line segments."""
for i in range(n):
t.fd(length)
t.lt(angle)
def polygon(t, n, length):
"""Draws a polygon with n sides."""
@vietlq
vietlq / howto-install-gcc5-on-ubuntu-14.md
Last active April 12, 2017 15:59
How to install gcc 5/g++ 5 on Ubuntu LTS 14.04 (Tested on Ubuntu & Windows 10 WSL)

How to install g++ 5 on Ubuntu LTS 14.04

Scope

Tested on Ubuntu & Windows 10 WSL

Steps

  1. Add ppa:ubuntu-toolchain-r/test
  2. Load updates from the new PPA
@vietlq
vietlq / howto-install-node6x-on-ubuntu14-ubuntu16.md
Last active May 10, 2017 15:03
How to install Node 6.x on Ubuntu 14 & Ubuntu 16

Code2Pro: How to install Node 6.x on Ubuntu 14 & Ubuntu 16

Scope

Tested on Ubuntu 14, Ubuntu 16 and Windows 10 WSL.

Steps

  1. Purge the old version of nodejs & npm
  2. Set up PPA and update
@vietlq
vietlq / howto-forward-x11-to-win10-via-putty-vcxsrv.md
Last active August 22, 2023 19:53
Code2Pro: How to Forward X11 to Windows 10 via PuTTY & vcxsrv

Code2Pro: How to Forward X11 to Windows 10 via PuTTY & vcxsrv

Scope

Tested on Windows 10 & Ubuntu 16.

Steps

  1. Check that sshd on Ubuntu is properly configured
@vietlq
vietlq / howto-install-latest-eclipse-on-ubuntu.md
Created April 12, 2017 19:27
Code2Pro: How to Install Latest Eclipse on Ubuntu

Code2Pro: How to Install Latest Eclipse on Ubuntu

Scope

Tested with Ubuntu 16

Steps

  • Install JDK
@vietlq
vietlq / Makefile
Last active April 13, 2017 20:08
Code2Pro: How to Generate Eclipse CDT Project Files Using CMake
.PHONY: all init build clean bclean rebuild fresh eclipse
PROJECT_DIR=$(shell pwd)
BASENAME=$(shell basename `pwd`)
BUILD_DIR=${HOME}/projects/_build/build-${BASENAME}
ECLIPSE_ROOT=${HOME}/eclipse/workspaces
ECLIPSE_PROJ=${ECLIPSE_ROOT}/cproject-${BASENAME}
all: init build run
@vietlq
vietlq / Virtual Box Host Only Static IP.md
Created April 15, 2017 20:50 — forked from pjdietz/Virtual Box Host Only Static IP.md
VirtualBox Host-Only Adapter with Static IP

VirtualBox Host-Only Static IP

My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.

To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)

Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.

Temporary