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 | |
/** | |
* Created by PhpStorm | |
* User: Xinyu | |
* Date: 16/8/25 | |
* Time: 下午10:09 | |
*/ | |
function unitConvert($scale){ | |
if($scale >= (1<<30)){ | |
$scale /= (1<<30); |
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 | |
# Author: Palemoky | |
email= | |
domain= | |
api_token= | |
dns_identifier= | |
zone_identifier= |
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 | |
# Author: Palemoky | |
# Change directory to work path | |
cd /path/to/work | |
pages=$(curl -sG --data-urlencode "country=美国" 'https://ip.jiangxianli.com/api/proxy_ips' | jq .data.last_page) | |
for page in $(eval echo {1..${pages}}); do |
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 | |
# Author: Palemoky | |
# Fetch image | |
img=$(curl -s 'https://bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&pid=hp&FORM=BEHPTB&video=1') | |
img_path=$(jq .images[0].url <<< $img) | |
img_name=$(jq .images[0].urlbase <<< $img) | |
img_name=${img_name#*=} |
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 | |
// 获取图片信息 | |
$img_info = file_get_contents('https://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&pid=hp&FORM=BEHPTB&video=1'); | |
// 请求失败时,使用「Server 酱」将错误信息推送至绑定的微信 | |
if (false === $img_info) { | |
file_get_contents('https://sc.ftqq.com/xxx.send?text=' . urlencode('Get bing wallpaper error!')); | |
} | |
$img_obj = json_decode($img_info)->images[0]; |
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 | |
// 驼峰命名法转蛇形命名法 | |
function camel2snake ($camel) { | |
if (false !== strpos($camel, '_')) { | |
return $camel; | |
} | |
$capitalLetters = range('A', 'Z'); | |
for ($i=1; $i < strlen($camel) - 1; $i++) { | |
if (in_array($camel[$i], $capitalLetters)) { |