Skip to content

Instantly share code, notes, and snippets.

Weilong Wang wilon

Block or report user

Report or block wilon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View wilon.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.089478947222232819</real>
View test-chan.go
package main
import (
"fmt"
"time"
)
func main() {
ch := make(chan int, 1)
View check_service.php
<?php
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
date_default_timezone_set('PRC');
define('APP_PATH', dirname(__FILE__));
class CONFIG
{
const EMAIL = [
'host' => 'xxx.com',
@wilon
wilon / timeDebug.php
Created Nov 7, 2017
Count php script run time.
View timeDebug.php
<?php
/**
* PHP time debug
* @param string $mark
* @param string $separate
* @return array
*/
function timeDebug($mark, $echo = true, $separate)
{
@wilon
wilon / app.php
Last active Oct 12, 2017
Add toran-proxy web authorize, and composer request not validated.
View app.php
<?php
use Symfony\Component\HttpFoundation\Request;
error_reporting(0);
$uri = parse_url($_SERVER['REQUEST_URI'])['path'];
$uri = trim($uri, '/');
if (in_array($uri, [
'', 'app.php',
'settings', 'app.php/settings',
View simpleCurl.php
<?php
/**
* simple curl
* @param string $url
* @param array $param
* @return mix
*/
function simpleCurl($url = '', $param = []) {
// params init
@wilon
wilon / isIplongInnerUse.php
Created Jul 20, 2017
是否是内网IP,>1为是
View isIplongInnerUse.php
function isIplongInnerUse($ipLong)
{
// 0.0.0.0 – 0.255.255.255 软件
if ($ipLong >= 0 && $ipLong <= 16777215) return 16777215 + 1;
// 10.0.0.0 – 10.255.255.255 专用网络
if ($ipLong >= 167772160 && $ipLong <= 184549375) return 184549375 + 1;
// 100.64.0.0 – 100.127.255.255 专用网络
if ($ipLong >= 1681915904 && $ipLong <= 1686110207) return 1686110207 + 1;
// 127.0.0.0 – 127.255.255.255 主机
if ($ipLong >= 2130706432 && $ipLong <= 2147483647) return 2147483647 + 1;
@wilon
wilon / transToPinyinFile.php
Last active Jul 19, 2017
将当前文件夹内的中文名文件转换为拼音文件
View transToPinyinFile.php
<?php
error_reporting(0);
$pin = new pin();
# echo $pin->Pinyin('王海燕','UTF8');
$dd = listDir('./');
$p = './';
foreach ($dd['lists'] as $d) {
$newName = $pin->Pinyin($d['name'], 'UTF8');
@wilon
wilon / warningPage.php
Created Jun 21, 2017
Show warning page in Browser.
View warningPage.php
function warningPage($title, $desc)
{
die("<!DOCTYPE html><html><body style='background-color:#ce3426;color:white;position:absolute;left:30%;top:30%;'><h1>$title</h1><pre>$desc</pre></body></html>");
}
@wilon
wilon / getFullURL.php
Last active Aug 6, 2017
Get the full URL in PHP.
View getFullURL.php
<?php
function getFullURL()
{
$s = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '';
$p = strtolower($_SERVER['SERVER_PROTOCOL']);
$protocol = substr($p, 0, strpos($p, '/')) . $s;
$host = $_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_ADDR'];
$uri = $_SERVER['REQUEST_URI'] == '/' ? '' : $_SERVER['REQUEST_URI'];
return urldecode("$protocol://$host$uri");
You can’t perform that action at this time.