In my case(my machine is ubuntu 16), I append /etc/resolvconf/resolv.conf.d/base file by adding below ns lines.
nameserver 8.8.8.8
nameserver 4.2.2.1
nameserver 2001:4860:4860::8844
nameserver 2001:4860:4860::8888
then run the update script,
#!/bin/bash | |
dir=$1 | |
if [ ! -d $dir ]; | |
then | |
echo "$dir does not exist" | |
exit 1 | |
fi |
package main | |
import ( | |
"fmt" | |
"strings" | |
"time" | |
"math" | |
) | |
func splitByWidthMake(str string, size int) []string { |
<?php | |
### run this with php 7.3 and php lower version such as php 7.2 | |
### time php re_bench.php | |
### time php73 re_bench.php | |
$regex_list = [ | |
'#Twain#', | |
'#(?i)Twain#', |
In my case(my machine is ubuntu 16), I append /etc/resolvconf/resolv.conf.d/base file by adding below ns lines.
nameserver 8.8.8.8
nameserver 4.2.2.1
nameserver 2001:4860:4860::8844
nameserver 2001:4860:4860::8888
then run the update script,
function mb_trim( $str ) { | |
return mb_ereg_replace( | |
'^[[:space:]]*([\s\S]*\S)?[[:space:]]*$', '\1', $str ); | |
} |
#!/bin/sh | |
# Script to compile nginx on ubuntu with lua support. | |
NGX_VERSION='1.6.2' | |
LUAJIT_VERSION='2.0.3' | |
LUAJIT_MAJOR_VERSION='2.0' | |
NGX_DEVEL_KIT_VERSION='0.2.19' | |
LUA_NGINX_MODULE_VERSION='0.9.15' | |
<?php | |
function is_intranet_ip($ip = null) { | |
if (!$ip) { | |
$ip = $_SERVER['REMOTE_ADDR']; | |
} | |
$long_ip = ip2long($ip); | |
$ret = false; | |
// 分别判断10. 192.168. 172.16-31. 127.0.0.1 | |
if ($long_ip >> 24 == 0xa || $long_ip >> 20 == 0xac1 || $long_ip >> 16 == 0xc0a8 || $long_ip == 0x7f000001) { |
<?php | |
ini_set('xdebug.trace_format', '1'); | |
class MyPhotoBO { | |
public static $SPEC_GIANT = "giant"; | |
public static $SPEC_BIG = "big"; | |
public static $SPEC_MIDDLE = "middle"; | |
public static $SPEC_MIDDLE_BIG = "middlebig"; | |
public static $SPEC_SQUARE_200 = "middlesquare"; | |
public static $SPEC_SQUARE_100 = "smallsquare"; | |
public static $SPEC_FIT_100 = "smallfit"; |
<?php | |
## 测试 if else 和switch 哪个更快 | |
## 测试结果是 if else 更快 | |
// prepare test data | |
$MAX = 1000000; | |
$data = array(); | |
$actions = array("add", "remove", "edit"); | |
$rates = array(1, 1, 1); | |
$limits = array(); |
<?php | |
## 测试到底是i++ 快还是 ++i快 | |
$MAX = 1000000; | |
$start_ts = microtime(true); | |
for ($i = 0; $i < $MAX; $i++) { | |
$a = 1; |