Skip to content

Instantly share code, notes, and snippets.

View trungx's full-sized avatar
🚩
Go to 2022

trungx

🚩
Go to 2022
View GitHub Profile
@trungx
trungx / docker-php-ext-install.md
Created May 5, 2020 18:40 — forked from giansalex/docker-php-ext-install.md
docker-php-ext-install Reference
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 
@trungx
trungx / gigacube-reboot.rb
Created May 4, 2020 01:16 — forked from icy/gigacube-reboot.rb
gigacube-reboot.rb
#!/usr/bin/env ruby
# Author : Ky-Anh Huynh
# License : MIT
# Date : 2020-05-02
# Usage :
#
# $ gem install watir headless
# $ pacman -s xvfb
# $ PASSWORD="your_router_password" ./restart.rb
@trungx
trungx / clear-credential-manager.cmd
Created February 18, 2020 08:48 — forked from tomfanning/clear-credential-manager.cmd
Batch file to clear all credentials from Windows Credential Manager
@echo off
cmdkey.exe /list > "%TEMP%\List.txt"
findstr.exe Target "%TEMP%\List.txt" > "%TEMP%\tokensonly.txt"
FOR /F "tokens=1,2 delims= " %%G IN (%TEMP%\tokensonly.txt) DO cmdkey.exe /delete:%%H
del "%TEMP%\List.txt" /s /f /q
del "%TEMP%\tokensonly.txt" /s /f /q
echo All done
pause
@trungx
trungx / nginxproxy.md
Created December 17, 2019 04:19 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

Beginner: Linked List, Stack, Queue, Binary Search Tree.
Intermediate: Heap, Priority Queue, Huffman Tree, Union Find, Tries, Hash Table, Tree Map.
Proficient: Segment Tree, Binary Indexed Tree, Suffix Array, Sparse Table, Lowest Common Ancestor, Range Tree.
Expert: Suffix Automaton, Suffix Tree, Heavy-Light Decomposition, Treap, Aho-Corasick, K-d tree, Link-Cut Tree, Splay Tree, Palindromic Tree, Rope, Dancing Links, Radix Tree, Dynamic Suffix Array.
<!DOCTYPE html>
<html>
<head>
<title>Google Fonts Preview</title>
<style>
#preview {
margin: 0 auto;
text-align: center;
width: 80%;
}
@trungx
trungx / load_proper.js
Created July 22, 2019 05:36 — forked from ryanmcgrath/load_proper.js
How to properly branch loading of JS
/* Since script loading is dynamic, we take
a callback function with our loadScript call
that executes once the script is done downloading/parsing
on the page.
*/
var loadScript = function(src, callbackfn) {
var newScript = document.createElement("script");
newScript.type = "text/javascript";
newScript.setAttribute("async", "true");
newScript.setAttribute("src", src);
@trungx
trungx / nginx.conf
Created May 29, 2019 03:41 — forked from flatanimals/nginx.conf
Nginx server config for Laravel 4 and SimpleSamlphp
#
# Nginx host conf
#
# Allows Laravel 4 and SimpleSamlphp to exist together peacefully
#
# Laravel 4 -
# https://github.com/laravel/laravel
# SimpleSamlphp -
# https://github.com/simplesamlphp/simplesamlphp
#
@trungx
trungx / gist:9a6441aae59f2c2b89d0faaad545cac7
Created May 4, 2019 04:56 — forked from Mikodes/gist:be9b9ce42e46c3d4ccb6
All Media queries for resolutions
/* (320x480) iPhone (Original, 3G, 3GS) */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
/* insert styles here */
}
/* (320x480) Smartphone, Portrait */
@media only screen and (device-width: 320px) and (orientation: portrait) {
/* insert styles here */
}
@trungx
trungx / Install env OSX
Created April 9, 2019 03:09 — forked from pnlinh/Install env OSX
Install env for web develop with nginx, php, mysql, git...
# Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
# Zsh (can skip)
brew install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
brew install nginx