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 / 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 / gmail_imap_dump_eml.py
Last active November 5, 2018 17:13 — forked from robulouski/gmail_imap_dump_eml.py
Gmail IMAP Exporter Tool
#!/usr/bin/env python
#
# Very simple Python script to dump all emails in an IMAP folder to files.
# This code is released into the public domain.
#
# RKI Nov 2013
#
import sys
import imaplib
import getpass
@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 / 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 / encoding-video.md
Created June 4, 2018 10:17 — forked from Vestride/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 April 21, 2018 08:17
Install Docker And Docker Compose Ubuntu 16.04
#! /bin/bash
export DEBIAN_FRONTEND=noninteractive
sudo apt -y update
sudo apt install apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt -y update
sudo apt purge lxc-docker
sudo apt-cache policy docker-engine
sudo apt -y install linux-image-extra-$(uname -r) linux-image-extra-virtual
@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 / bootstrap.sh
Created November 20, 2016 15:41
Ubuntu 16.04 bootstrap script
#!/bin/sh
sudo sed -i "s/IPV6=yes/IPV6=no/" /etc/default/ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw --force enable
sudo ufw reload
sudo sed -i "s/.*PasswordAuthentication .*/PasswordAuthentication no/" /etc/ssh/sshd_config
@khanhicetea
khanhicetea / Unlike-all-fanpage-on-FB.md
Last active December 11, 2017 12:48
Unlike all fanpages on Facebook
  1. Go to FB Wall > View Activity Log > Likes > Pages and Interests
  2. Scroll to the end of log (more log more pages could be unliked)
  3. Open Console (F12 > Tab Console)
  4. Paste this code to console and Enter.
var links = $$('._42ft._42fu._4-s1._2agf._p._42gx');
var i = 0;

unlike_all = function () {
 links[i].click();
@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