Skip to content

Instantly share code, notes, and snippets.

@rming
rming / README-Template.md
Created January 2, 2020 02:46 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@rming
rming / gist:27911edda129828665a02060eca0f029
Last active September 26, 2019 07:55
What is the difference between dot and "source" ?
#!/sbin/sh
source /sdcard/bash_init.sh
@rming
rming / continue_clone.sh
Last active September 11, 2019 03:43
自动根据分支下载代码的脚本
#!/usr/bin/env bash
# 配置每个 fork 文件存储位置
PATH_FORK=/data/forks/dragonpilot
PATH_GERNBY=${PATH_FORK}/gernby
PATH_OPENPILOT=${PATH_FORK}/openpilot
PATH_DRAGONPILOT=${PATH_FORK}/dragonpilot
# 配置每个 fork 的 git 地址
GIT_GERNBY=https://github.com/Gernby/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}"`
@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 / 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;
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"
<?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;
@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"';
@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,
},
{