代码 32 篇

debian部署

个人环境部署

apt-get install sudo
apt-get install vim

vim /etc/sudoers
#增加 shagon ALL=(ALL:ALL) NOPASSWD:ALL

sudo vim /etc/vim/vimrc
#去掉 syntax on 前的注释
set tabstop=4
set softtabstop=4
colorscheme desert

vim /home/shagon/.ssh/authorized_keys
#增加本地密钥

#安装 oh-my-zsh
sudo apt-get install zsh
sudo apt-get install git
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
sudo apt-get install autojump

- 全文剩余 70% -

62进制转换

//十进制转为 62 进制
function encode62($number)
{
$base = 62;
$index = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$ret = '';
for ($t = floor(log10($number) / log10($base)); $t >= 0; $t--) {
$a = floor($number / pow($base, $t));
$ret .= substr($index, $a, 1);
$number -= $a * pow($base, $t);
}
return $ret;
}

//62 进制转为十进制
function decode62($number)
{
$base = 62;
$index = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$ret = 0;
$len = strlen($number) - 1;
for ($t = 0; $t <= $len; $t++) {
$ret += strpos($index, substr($number, $t, 1)) * pow($base, $len - $t);
}
return $ret;
}