Skip to content

Instantly share code, notes, and snippets.

[unix_http_server]
file=/tmp/supervisor.sock ; socket文件的路径,supervisorctl用XML_RPC和supervisord通信就是通过它进行
的。如果不设置的话,supervisorctl也就不能用了
不设置的话,默认为none。 非必须设置
;chmod=0700 ; 这个简单,就是修改上面的那个socket文件的权限为0700
不设置的话,默认为0700。 非必须设置
;chown=nobody:nogroup ; 这个一样,修改上面的那个socket文件的属组为user.group
不设置的话,默认为启动supervisord进程的用户及属组。非必须设置
;username=user ; 使用supervisorctl连接的时候,认证的用户
不设置的话,默认为不需要用户。 非必须设置
package main
import (
"fmt"
"reflect"
)
func StructToMap(s interface{}) map[string]interface{} {
m := make(map[string]interface{})
elem := reflect.ValueOf(s).Elem()
@rming
rming / purge.lua
Created April 10, 2019 06:08 — forked from titpetric/purge.lua
Delete NGINX cached items from a PURGE request
-- Tit Petric, Monotek d.o.o., Thu 27 Oct 2016 10:43:38 AM CEST
--
-- Delete nginx cached assets with a PURGE request against an endpoint
--
local md5 = require 'md5'
function file_exists(name)
local f = io.open(name, "r")
if f~=nil then io.close(f) return true else return false end
@rming
rming / gist:81e206a9125fe9aff15c37b03a40cd91
Last active June 19, 2019 02:21
最小二乘法拟合直线和点到直线的距离
var data = [
{
y:10.98,
x:35.3,
},
{
y:11.13,
x:29.7,
},
{
@rming
rming / nginx.conf
Created June 21, 2019 02:42
Filter and sort the slowest request
log_format main '$http_x_forwarded_for - $remote_user [$time_local] "$http_host" "$request" code:$status $body_bytes_sent $http_referer "$http_user_agent" "$request_time" "$upstream_response_time" "$upstream_addr" "$upstream_status" "server:$http_x_select_server"';
<?php
function normalFind($a, $b){
$matches = [];
$lena = strlen($a);
$lenb = strlen($b);
for ($i=0; $i < strlen($a); $i++) {
for ($j=0; $j < $lenb; $j++) {
if ($i + $j >= $lena) {
break;
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
git clone https://github.com/commaai/openpilot.git --config "http.proxy=proxyHost:proxyPort"
@rming
rming / subString.js
Created August 29, 2019 11:07 — forked from roshanca/subString.js
截取指定长度的中英文混合字符串
/**
* 截取指定长度的中英文混合字符串
* @param {String} str 待截取的字符串
* @param {Number} n 截取长度(中文字符为英文的 double)
* @return {String} 截取后的字符串
*/
function subString(str, n) {
var r = /[^\x00-\xff]/g;
var m;
@rming
rming / change_forks.sh
Created September 10, 2019 10:08
change openpilot forks script
#!/bin/env bash
if [ $# != 1 ] ; then
echo "USAGE: $0 OPENPILOT_PATH"
echo " e.g.: $0 /data/forks/gernby"
exit 1;
fi
rm -f /data/openpilot
@rming
rming / continue.sh
Last active December 31, 2020 00:28
#!/usr/bin/env bash
# 配置每个 fork 目录位置
PATH_FORK=/data/forks
PATH_FORK_1=${PATH_FORK}/gernby
PATH_FORK_2=${PATH_FORK}/openpilot
PATH_FORK_3=${PATH_FORK}/dragonpilot
switch=`cat /sys/devices/virtual/switch/tri-state-key/state`
VAR_OP_PATH=`eval echo "$""PATH_FORK_${switch}"`