Skip to content

Instantly share code, notes, and snippets.

View khanhicetea's full-sized avatar
😎
solving human problems

KhanhIceTea khanhicetea

😎
solving human problems
View GitHub Profile
@khanhicetea
khanhicetea / nginx.conf
Created November 5, 2015 07:26
NginX https redirect ( Cloudflare's flexible ssl )
server {
listen 80;
server_name example.com www.example.com;
if ($http_x_forwarded_proto = "http") {
return 301 https://$server_name$request_uri;
}
... directives to generate a response
}
Keybinding Action Tag
Ctrl+X Cut line (empty selection) basic-editing
Ctrl+C Copy line (empty selection) basic-editing
Alt+ ↓ / ↑ Move line down/up basic-editing
Ctrl+Shift+K Delete line basic-editing
Ctrl+Enter Insert line below basic-editing
Ctrl+Shift+Enter Insert line above basic-editing
Ctrl+Shift+\ Jump to matching bracket basic-editing
Home Go to beginning basic-editing
End Go to end of line basic-editing
Calc size of root directories
```bash
du -h . --max-depth=1 | sort -n -r | head -n 10
```
@khanhicetea
khanhicetea / Development.md
Created April 12, 2020 05:12
[Feed] Good Websites
@khanhicetea
khanhicetea / aws.txt
Last active February 27, 2020 12:47
[AWS, GCP, Azure IP Ranges] Nov 13 2017 updated
13.32.0.0/15
13.52.0.0/16
13.54.0.0/15
13.56.0.0/16
13.57.0.0/16
13.58.0.0/15
13.112.0.0/14
13.124.0.0/16
13.125.0.0/16
13.126.0.0/15
@khanhicetea
khanhicetea / utm_passing.js
Last active November 7, 2019 14:16
Pass UTM query params to all link in web page
(function() {
const params = new URLSearchParams(window.location.search);
const utm_params = [];
params.forEach(function(value, key) {
if (key.startsWith('utm_')) {
utm_params.push(key+'='+value)
}
})
utm_search = utm_params.join('&');
if (!!utm_search) {
@khanhicetea
khanhicetea / onepay.php
Last active November 7, 2019 03:16
OnePay Vietnam PHP SDK
<?php
class OnePayGateway
{
private $options = [
'version' => '2',
'currency' => 'VND',
'merchant' => 'ONEPAY',
'access_code' => 'D67342C2',
'secure_hash' => 'A3EFDFABA8653DF2342E8DAC29B51AF0',
@khanhicetea
khanhicetea / lemp_ubuntu_1604.sh
Last active August 7, 2019 19:04
LEMP Stack on Ubuntu 16.04
#!/bin/bash
# Disable IPv6
echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
# Firewall
sudo sed -i -e 's/IPV6=yes/IPV6=no/' /etc/default/ufw
@khanhicetea
khanhicetea / function.md
Last active July 22, 2019 10:57
Excel : get provider name of Vietnamese phone number

Replace A1 with your cell

Beatiful version

=IF(
    MID(A1,2,1)="9",
    IF(
        OR(MID(A1,3,1)="6",MID(A1,3,1)="7",MID(A1,3,1)="8"),
        "VIETTEL",
@khanhicetea
khanhicetea / iframe.html
Last active July 15, 2019 08:18
Test Iframe in webview
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script>
var setTempCookie = function (name, value) {
var now = new Date(),