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 / docker-gc.sh
Created November 6, 2016 02:59
Docker Garbage Collector
$ # Ref : https://github.com/docker/docker/pull/26108#issuecomment-243259942
$ # caveat that you get warnings on things that can't be removed
$ # remove all stopped containers
$ docker ps -aq | xargs --no-run-if-empty docker rm
$ # remove all unused volumes
$ docker volume ls -q | xargs --no-run-if-empty docker volume rm
$ # remove local volumes
$ docker volume ls | awk '/^local/ { print $2 }' | xargs --no-run-if-empty docker volume rm
@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 / 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 / gist:5a2cbfc6bfd216386a40db2197046ab0
Created October 4, 2016 12:59
Prevent virt-manager ask password (centos 6)

The password prompt was made for system security so if you do this might make it vulnerable.

Create the Group group on your machine. or you can run this "sudo groupadd -r [Group]" You can any user you want to this system group by runing "sudo usermod -a -G [Group] [User]" Now you need to create our PolicyKit policy that will allow the users of Group to run virt-manager you will create a file at this path:"/etc/polkit-1/localauthority/50-local.d/50-org.Group-libvirt-local-access.pkla" and you will put lines below in it

[Allow group [Group] libvirt management permissions]
@khanhicetea
khanhicetea / check.php
Last active September 24, 2016 03:47
Check valid vietnamese mobile phone number
<?php
function format_vn_phone($phone)
{
$phone = preg_replace('/[^0-9]/', '', $phone);
if (strlen($phone) > 10 && substr($phone, 0, 2) == '84') {
$phone = substr($phone, 2);
}
return substr(empty($phone) || $phone[0] == '0' ? $phone : '0'.$phone, 0, 11);
@khanhicetea
khanhicetea / shortcuts.txt
Created August 23, 2016 05:06
KeePassC Shortcuts
'e' - go to main menu
'q' - close program
'CTRL+D' or 'CTRL+C' - close program at any time
'x' - save db and close program
's' - save db
'S' - save db with alternative filepath
'c' - copy password of current entry
'b' - copy username of current entry
'H' - show password of current entry
'o' - open URL of entry in standard webbrowser
map l nextTab
map h previousTab
<?php
/**
* TimThumb by Ben Gillbanks and Mark Maunder
* Based on work done by Tim McDaniels and Darren Hoyt
* http://code.google.com/p/timthumb/
*
* GNU General Public License, version 2
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Examples and documentation available on the project homepage
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="3;URL=https://ghth.vn/" />
<title>Đang Chuyển Hướng ...</title>
<style>
body {
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
@khanhicetea
khanhicetea / Vagrantfile
Created December 5, 2015 17:36
PHP Box Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at