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
| /// A standard base64 encoder and decoder. | |
| /// | |
| /// This struct provides methods for encoding and decoding data using the standard base64 encoding scheme. | |
| /// It supports both standard and URL-safe base64 encoding. | |
| /// | |
| /// Author: | |
| /// Pedro Faria (https://github.com/pedropark99/) | |
| /// Ryan Liu (https://github.com/azhai/) | |
| /// Refer: | |
| /// https://pedropark99.github.io/zig-book/Chapters/01-base64.html |
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
| #用于按天切割supervisor管理或任务进程日志 | |
| #0 0 * * * /bin/gawk -f /opt/scripts/logcut.awk /var/log/supervisor/*.log | |
| BEGIN { | |
| "date -d yesterday +%Y-%m-%d" | getline yesterday #零点执行,获取昨天的日期 | |
| } | |
| $1 <= yesterday { | |
| positions[FILENAME] = FNR #记录每个日志文件读取到哪里 | |
| day = $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
| #!/bin/bash | |
| # * * * * * /home/ryan/bin/script_keeper.sh | |
| APP_BIN="/usr/bin/python" | |
| APP_FILE="/home/ryan/tools/remove_vod_files.py" | |
| PROGS=( | |
| "asc" | |
| "desc" | |
| ) |
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 | |
| i=0 | |
| declare -a args | |
| for x in "$@"; do | |
| args[$i]=$(readlink -f "$x") | |
| i=$(expr $i + 1) | |
| done | |
| user=ryan |
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 getGlobalConfig($key) { | |
| if (empty($key) || !extension_loaded('apcu') || !apcu_enabled()) { | |
| return null; | |
| } | |
| $cache_key = 'globals'; |
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 | |
| $uploadUrl = 'http://test.com/upload.php'; | |
| // 转发从其它客户端上传的文件,上传时字段name="file",但接收方字段name="attachment" | |
| redirect_upload($uploadUrl, 'attachment', $_FILES['file']); | |
| /* | |
| * 转发上传文件 | |
| */ | |
| function redirect_upload($url, $field = 'file', $file = null) |
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
| /^replace \(/, /^\)/{ | |
| if($0~/^\s+/) | |
| system("go get -u "$3) | |
| } | |
| /^require \(/, /^\)/{ | |
| if($0~/^\s+/) | |
| system("go get -u "$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" | |
| "reflect" | |
| ) | |
| func Decorate(impl interface{}) interface{} { | |
| fn := reflect.ValueOf(impl) |
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/sh | |
| # start gogs web | |
| IFS='- | |
| >---' | |
| PATH=/bin:/usr/bin:/usr/local/bin:/opt/bin | |
| HOME=${HOME:?"need \$HOME variable"} | |
| USER=$(whoami) | |
| export USER HOME PATH |
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 | |
| PWD=`cd $(dirname "${BASH_SOURCE[0]}") && pwd` | |
| APP_BIN="/usr/bin/php" | |
| APP_ENTRY="$PWD/index.php" | |
| LOG_DIR="$PWD/application/logs" | |
| PROGS=( | |
| "image check" | |
| "apns feedloop" | |
| "apns pushloop prod" |
NewerOlder