Skip to content

Instantly share code, notes, and snippets.

@DogeVenci
DogeVenci / generate.go
Created December 8, 2020 00:46
protoc
//go generate protoc -I ./proto -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out ./services --go-grpc_out ./services --grpc-gateway_out ./services --grpc-gateway_opt logtostderr=true hub.proto
//go:generate protoc -I ./proto --js_out=import_style=commonjs:./services --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./services hub.proto
@DogeVenci
DogeVenci / select.js
Last active November 25, 2020 14:25
点击selector 筛选相同
var jquery = document.createElement('script');
jquery.src = "https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js";
//若调试页面是https的这里也修改为https.
document.getElementsByTagName('head')[0].appendChild(jquery);
jQuery.noConflict();
@DogeVenci
DogeVenci / gist:e215891d7bf00c9b80ae37baadd51f8a
Created January 7, 2019 14:23
mongo 分段聚合查询 字符串转int
db.getCollection('xxx').aggregate([
{
$project: {
_id: 0,
mage: { $toInt: "$age" //age 字符串类型转int比较过滤
}
}
},
{
$match: {
@DogeVenci
DogeVenci / scenesplit.sh
Last active April 15, 2021 03:02
sh ./scenesplit.sh inputfile.mp4
#/bin/bash
start=0;
count=0;
in="$1"
#bn="$(basename "$in")"
bn="out"
echo "=============================================================================="
echo "FILE START: $bn"
mkdir "./$bn"
@DogeVenci
DogeVenci / trackers-list-aria2.sh
Last active June 12, 2019 11:20
[trackers-list-aria2.sh] 自动更新bt-tracker #shell #aria2 #bt #awk
#!/bin/bash
/usr/sbin/service aria2 stop
list=`wget -qO- https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt|awk NF|sed ":a;N;s/\n/,/g;ta"`
if [ -z "`grep "bt-tracker" /root/.aria2/aria2.conf`" ]; then
sed -i '$a bt-tracker='${list} /root/.aria2/aria2.conf
echo add......
else
sed -i "s@bt-tracker.*@bt-tracker=$list@g" /root/.aria2/aria2.conf
echo update......
fi
@DogeVenci
DogeVenci / access.log
Last active August 30, 2018 03:26
[提取日志中ip地址并且自动查询归属地] #shell #ip #awk #regex
2018/08/16 19:05:59 udp:182.89.62.114:4183 accepted tcp:clients1.google.com:443
2018/08/16 19:06:04 udp:182.89.62.114:4183 accepted tcp:[2001:b28:f23f:f005::a]:443
2018/08/16 19:06:04 udp:182.89.62.114:4183 accepted tcp:91.108.56.130:443
2018/08/16 19:06:04 udp:182.89.62.114:4183 accepted tcp:91.108.56.130:80
2018/08/16 19:06:15 udp:182.89.62.114:4183 accepted tcp:149.154.166.120:80
2018/08/16 19:06:15 udp:182.89.62.114:4346 accepted tcp:149.154.166.120:443
2018/08/16 19:06:15 udp:182.89.62.114:4183 accepted tcp:149.154.166.120:443
2018/08/16 19:06:15 udp:182.89.62.114:4183 accepted tcp:[2001:67c:4e8:f004::b]:443
2018/08/16 19:06:15 udp:182.89.62.114:4346 accepted tcp:[2001:67c:4e8:f004::b]:443
2018/08/16 19:06:15 udp:182.89.62.114:4346 accepted tcp:149.154.166.120:80
@DogeVenci
DogeVenci / backup.sh
Last active August 30, 2018 03:23
[备份并上传百度] #shell #backup #baidu
BACK_DIR="/data/discuz"
WORK_DIR="/root/discuz_backup"
discuz_DATA=discuz_$(date +"%Y%m%d").tar.gz
if [ ! -d $WORK_DIR ];
then
mkdir -p "$WORK_DIR"
fi
cd $WORK_DIR
rm ./*.tar.gz
@DogeVenci
DogeVenci / proxy.js
Last active August 30, 2018 03:29
[nodejs proxy] #nodejs #proxy
'use strict';
var http = require('http');
var https = require('https');
var httpProxy = require('http-proxy');
var url = require('url');
var PROXY_PORT = 80;
var proxy, server;
@DogeVenci
DogeVenci / pre-receive.sh
Last active August 30, 2018 03:44
[git钩子]pre-receive #git #shell #regex
#!/bin/sh
echo "--------------push commit msg检查--------------"
regex="^\[(CarPlay|8327)\].{10,}" #符合要求格式的正则表达式
while read oldsha newsha refname; do
# echo "update : $oldsha,$newsha,$refname"
ret=`git log --pretty=format:%s $oldsha..$newsha|awk '$1 !~ /'"$regex"'/ {print $1}'`
echo $ret
if [ ! -n "$ret" ]; then
echo "符合格式要求"
@DogeVenci
DogeVenci / pre-receive.py
Last active August 30, 2018 03:45
[git钩子Python]git pre-receive python script #git
#!/usr/bin/env python
#coding:utf-8
print '----- pre-receive start -----'
import sys,subprocess,re
def validate_commit_msg(msg):
if len(msg)<10:
return False
else: