This file contains 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
import subprocess | |
from pathlib import Path | |
from loguru import logger | |
def merge_vids(vidlist_file: str, tofile: str): | |
"""执行 ffmpeg 命令合并视频。""" | |
cmd = f"ffmpeg -f concat -safe 0 -i {vidlist_file} -c:v copy -c:a flac -strict -2 {tofile}" | |
subprocess.run(cmd) |
This file contains 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 randomFromDev($len) | |
{ | |
$fp = @fopen('/dev/urandom','rb'); | |
$result = ''; | |
if ($fp !== FALSE) { | |
$result .= @fread($fp, $len); | |
@fclose($fp); | |
} |
This file contains 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 hs() { | |
( cd ~/Homestead && vagrant $* ) | |
} | |
function proxy() { | |
export http_proxy=http://127.0.0.1:1080 | |
export https_proxy=$http_proxy | |
echo "Done" | |
} | |
function disproxy() { | |
unset http_proxy https_proxy |
This file contains 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 | |
$redis = new Redis(); | |
$redis->connect('127.0.0.1', 6379); | |
$redis->auth("php001"); | |
//这个key记录该ip的访问次数 也可改成用户id | |
//$key = 'userid_11100'; | |
$key=get_real_ip(); | |
//限制次数为5 | |
$limit = 5; |
This file contains 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" | |
func main() { | |
f := fibonacci() | |
for i:=0; i<10; i++ { | |
fmt.Println(f()) | |
} | |
} |
This file contains 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" | |
) | |
func main() { | |
a,b := 10,20 | |
a,b = swapNumOne(a,b) | |
fmt.Println("第一种:", a,b) |
This file contains 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 | |
// exit; | |
for ($i = 1; $i < 10; $i++) { | |
for ($j = $i; $j < 10; $j++) { | |
echo "{$i}" . "x" . "{$j}" .'='. ($i * $j) . ' '; | |
} | |
echo "\n"; | |
} |
This file contains 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
alias ..="cd .." | |
alias ...="cd ../.." | |
alias h='cd ~' | |
alias c='clear' | |
alias art=artisan | |
alias phpspec='vendor/bin/phpspec' | |
alias phpunit='vendor/bin/phpunit' | |
alias serve=serve-laravel |
This file contains 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 | |
/** | |
* A helper file for Laravel 5, to provide autocomplete information to your IDE | |
* Generated for Laravel 5.5.13 on 2017-09-28. | |
* | |
* @author Barry vd. Heuvel <barryvdh@gmail.com> | |
* @see https://github.com/barryvdh/laravel-ide-helper | |
*/ | |
namespace { | |
exit("This file should not be included, only analyzed by your IDE"); |
This file contains 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 | |
$query = User::find() | |
->where(['id'=>[1,2,3,4]) | |
->select(['username']) | |
// get the AR raw sql in YII2 | |
$commandQuery = clone $query; | |
echo $commandQuery->createCommand()->getRawSql(); |
NewerOlder