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 / vst-install-rhel.sh
Created November 20, 2015 11:18
VestaCP-Centos-PHP5.6
#!/bin/bash
# Vesta RHEL/CentOS installer v.05
#----------------------------------------------------------#
# Variables&Functions #
#----------------------------------------------------------#
export PATH=$PATH:/sbin
RHOST='r.vestacp.com'
CHOST='c.vestacp.com'
@khanhicetea
khanhicetea / .bash_alias
Created November 25, 2015 05:15
PHP Security Check Alias
alias php_sec="curl -H 'Accept: text/plain' https://security.sensiolabs.org/check_lock -F lock=@`pwd`/composer.lock"
@khanhicetea
khanhicetea / phpbox.sh
Last active December 4, 2015 19:03
Ubuntu PHP Box
#!/bin/bash
sudo apt-get update -y
# Add repository
sudo apt-get install -y python-software-properties
sudo add-apt-repository ppa:ondrej/php5-5.6 -y
sudo apt-add-repository ppa:rwky/redis -y
sudo apt-add-repository ppa:chris-lea/node.js -y
sudo apt-get update -y
<?php
error_reporting(0);
$filename = __DIR__.preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
if (php_sapi_name() === 'cli-server' && is_file($filename)) {
return false;
}
define('ROOT_PATH', dirname(dirname(__FILE__)));
@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
<!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;
}
<?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
map l nextTab
map h previousTab
@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
@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);