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 / main.go
Created August 14, 2017 05:39
Drone webhook access token generator (version 0.4.0)
package main
import (
"fmt"
"github.com/drone/drone/shared/token"
)
func main() {
repo_hash := "[SELECT `repo_hash` FROM `repos` where `repo_full_name` = <YOUR_REPO_FULLNAME>]"
repo_fullname := "<YOUR_REPO_FULLNAME>"
@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 / Dockerfile
Created November 22, 2017 02:59
Docker mysql remove ssl generator
FROM mysql:5.7
# Remove mysql_ssl_rsa_setup to ignore setup SSL certs
RUN rm -f /usr/bin/mysql_ssl_rsa_setup
@khanhicetea
khanhicetea / vim.csv
Last active March 2, 2018 06:44
Tango Flash Cards
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 9.
ESC,normal mode
`,[motion] go to mark point
~,[command] toggle case
!,[operator] external filter
@,[command] play a macro
#,[motion] previous indent
$,[motion] end of line
%,[motion] go to match open/close symbol
^,[motion] "soft" begin of line - first char not blank space
&,[command] repeat :s (:s search and replace in current line)
@khanhicetea
khanhicetea / encrypt.md
Last active October 1, 2018 16:32
[Encrypt and Decrypt file using openssl] #encrypt #decrypt

Encrypt

openssl enc -aes-256-cbc -in [input] -out [output]

Decrypt

openssl enc -aes-256-cbc -d -in [input] &gt; [output]
@khanhicetea
khanhicetea / encoding-video.md
Created June 4, 2018 10:17 — forked from glen-cheney/encoding-video.md
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@khanhicetea
khanhicetea / install.sh
Last active October 1, 2018 16:31
[Install php in ubuntu via ppa] #php #ubuntu
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.1-bz2 php7.1-cli php7.1-common php7.1-curl php7.1-dev php7.1-fpm php7.1-gd php7.1-imap php7.1-intl php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-opcache php7.1-readline php7.1-soap php7.1-sqlite3 php7.1-xml php7.1-xmlrpc php7.1-xsl php7.1-zip
@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(),
@khanhicetea
khanhicetea / area.php
Last active May 26, 2019 16:10
Danh sách địa phương (tỉnh / tp > quận / huyện > phường / xã)
<?php
// https://github.com/madnh/hanhchinhvn/tree/master/dist
$result = [];
$data = json_decode(file_get_contents('tree.json'), true);
foreach ($data as $a => $province) {
$p = [];
foreach ($province['quan-huyen'] as $b => $district) {
$d = [];
foreach ($district['xa-phuong'] as $c => $ward) {
@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) {