This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace common\helper; | |
class Url | |
{ | |
static function get($url, $params, $timeout = 30){ | |
$url = $url.'?'.self::makeQueryString($params); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# 1024 取模脚本 | |
mod() { | |
x=$1 | |
y=1024 | |
z=$((x%y)) | |
echo $z | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @Author Cryven | |
* @Date 2019-11-12 13:40:42 | |
*/ | |
function get($url, $params, $timeout = 3) | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# XPS13 touchpad enable/disable. | |
ID=$(xinput list | grep DLL.*Touchpad | awk '{print $6}' | awk -F'=' '{print $2}') | |
STATE=$(xinput list-props $ID | grep 'Device Enabled' | awk '{print $4}') | |
if [ $STATE -eq 1 ]; then | |
xinput disable $ID | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 当前 cron 触发的进程获取 redis 锁 | |
* | |
* 主要是防止在跑 cron 时,上一个 cron 计算尚没完成, | |
* 从而导致,重复执行计算的情况. | |
* | |
* 例如:1 * * * * 的定时任务,一分钟内计算未完成, | |
* 又再次触发,则会出现重复计算的混乱情况. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
) | |
func main() { | |
req, err := http.NewRequest("GET", "https://cn.bing.com", nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
) | |
func main() { | |
scanner := bufio.NewScanner(os.Stdin) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"os" | |
) | |
func main() { | |
var ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getParam(paramName, defaultValue = '') | |
{ | |
let url = location.search; | |
let params = new Object(); | |
if (url.indexOf('?') != -1) { | |
url = url.slice(1); | |
strs = url.split('&'); | |
strs.forEach(function (str) { |