Skip to content

Instantly share code, notes, and snippets.

View shellus's full-sized avatar

WaWaPi shellus

View GitHub Profile
@shellus
shellus / Counter.php
Last active September 29, 2021 06:17
Laravel mysql Counter code
/**
* @param $tag
* @param int $num
* @return int|mixed
*/
public static function incr($tag, $num = 1)
{
if ($num < 1) {
throw new \Exception('num err');
@shellus
shellus / ffmpeg.sh
Last active September 26, 2021 11:51
ffmpeg multiple processes directory videos
#!/bin/bash
set -e
handler(){
path=$@
filename=$(basename "${path}")
basename=${filename%.*}
dirname=$(dirname "${path}")
newname=$dirname/$basename.mp4
ffmpeg -i "$path" "$newname"
@shellus
shellus / pipe-caller.php
Created December 25, 2018 02:15
进程管道调用php函数
$handle = fopen("php://stdin", 'r');
while (!feof($handle)) {
$line = stream_get_line($handle, 1024*1024*10, "\r\n");
$requestObj = json_decode($line, true);
$response = (new $requestObj['calss'])->$requestObj['method'](...$requestObj['args']);
echo json_encode($response) . "\r\n";
}
fclose($handle);
@shellus
shellus / vue-router-nginx.conf
Last active July 31, 2018 02:28
vue-router Vue路由+laravel后端的同域名解决跨域问题的nginx配置
server {
server_name love.endaosi.com;
charset utf-8;
location / {
index index.html;
root /data/www/love-vue/dist;
try_files $uri $uri/ /index.html;
}
location ~ /api {
@shellus
shellus / README.md
Last active October 2, 2017 08:45
Nginx use GeoIP show IP And Location Info Guide

download GeoIP databases

mkdir /etc/nginx/geoip
cd /etc/nginx/geoip
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
<?php
/**
* Created by PhpStorm.
* User: shellus-in
* Date: 2017/9/28
* Time: 17:50
*/
class Test
{
package main
import (
"encoding/gob"
"bytes"
"reflect"
"fmt"
)
type MyStruct struct {
@shellus
shellus / TRG212M-try-password.go
Created September 16, 2017 02:33
TRG212M router password try
package main
import (
"net/http"
"net/url"
"io/ioutil"
"strings"
"fmt"
"bufio"
"os"
@shellus
shellus / password.txt
Created September 16, 2017 02:32
弱密码字典
123456789
1234567890
a123456789
123456
qq123456
abc123456
123456789a
WOAINI1314
12345678
11111111
<?php
/**
* Created by PhpStorm.
* User: shellus
* Date: 2017/8/28
* Time: 11:30
*/
$fd = fopen("pass.txt", "r");
// 如果php运行在linux,那么pass.txt里面的换行符用\n
// 如果php运行在windows,那就用\r\n