Skip to content

Instantly share code, notes, and snippets.

@b1tg
b1tg / p.sh
Created November 25, 2018 03:19
curl POST json
# method 0
vim body.json # write json
curl -H "Content-Type: application/json" --data @body.json http://localhost:8080/ui/webapp/conf
# method 1
curl --header "Content-Type: application/json" \
--request POST \
--data '{"username":"xyz","password":"xyz"}' \
http://localhost:3000/api/login
@b1tg
b1tg / connect.sh
Last active June 11, 2018 02:12
[树莓派指定端口连接]
ssh-copy-id -p 53 pi@172.20.62.63 # 复制密钥,无密码登录
scp -P 53 ~/Downloads/ngrok-stable-linux-arm.zip pi@172.20.62.63:/home/pi # scp -P 指定端口
ssh -p 53 pi@172.20.62.63 # ssh -p 指定端口
import xmlrpclib
import random
import schedule
address="127.0.0.1"
proxy = xmlrpclib.ServerProxy("http://"+ address +":8000/", allow_none = True)
multicall = xmlrpclib.MultiCall(proxy)
def tt():
value={
@b1tg
b1tg / schedule_demo.py
Created June 10, 2018 16:08
[定时调用] schedule库
import schedule
import time
def job():
print("I'm working...")
schedule.every(10).minutes.do(job)
schedule.every().hour.do(job)
schedule.every().day.at("10:30").do(job)
schedule.every().monday.do(job)
@b1tg
b1tg / tmux_cheatsheet.markdown
Created January 22, 2018 07:04 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@b1tg
b1tg / grep.sh
Created January 15, 2018 14:13
[grep] grep in folder
grep -nr 'yourString*' .
# The dot at the end searches the current directory. Meaning for each parameter:
#-n Show relative line number in the file
#'yourString*' String for search, followed by a wildcard character
#-r Recursively search subdirectories listed
#. Directory for search (current directory)
@b1tg
b1tg / process.sh
Created December 23, 2017 08:06
[Linux command]
ps -a # 列出所有运行中/激活进程
ps -ef |grep python #?
ps -aux # ?
pstree #进程树
top
htop
sudo nice --3 top # 以优先值-3启动top,优先级值的范围是[-20,19],值越低级别越高,可通过top中的NI(nice value)查看
renice -n 4 -p 3806 # 改变指定进程的优先值 -n 优先级 ,-p 进程
renice -3 -u mm # 用户mm所有的进程优先值变为-3
killall -9 python #杀死所有python进程
@b1tg
b1tg / 0.html
Last active December 20, 2017 15:31
[Vue] #js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>vue</title>
<script src="https://unpkg.com/vue"></script>
</head>
@b1tg
b1tg / log.js
Last active December 20, 2017 14:09
[console] #js
console.log()