Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Forer Casxt

💭
I may be slow to respond.
View GitHub Profile
@Casxt
Casxt / multipart_post.py
Created Jun 22, 2020
python3 request multipart post example
View multipart_post.py
import requests
import io
import json
from pprint import pprint
buffer = b'123123123'
params = [
# 文本类型数据
# RecoderId 是表单字段名
# BreakIn 是字段内容
View caddy filemanager forwardproxy websocket _roxy
eg.com:443 {
proxy /hk http://localhost:1081 {
header_upstream Connection {>Connection}
header_upstream Upgrade {>Upgrade}
}
filebrowser / /mnt/filedisk {
database /etc/filebrowser/filebrowser.db
auth_method json
}
View darknet usage
darknet detect cfg/yolov3.cfg yolov3.weights -i 0 -thresh 0.25 1.jpg
View git set socks5
# set
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
# unset
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
@Casxt
Casxt / opencv_imgencode_usage.py
Created Dec 10, 2018
opencv imgencode usage
View opencv_imgencode_usage.py
ret, imgBytes = cv2.imencode(".jpg", cv2_img)
if ret:
bytes = imgBytes.tobytes()
@Casxt
Casxt / benchmark
Created Dec 10, 2018
Pillow & skimage & OpenCV image encode benchmark
View benchmark
import numpy
from skimage import io
import time
from PIL import Image
import cv2
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from config import projectPath
@Casxt
Casxt / postgresql常用操作.md
Last active Nov 28, 2018
postgresql常用操作
View postgresql常用操作.md

安装

yum install postgresql-server postgresql-contrib
sudo postgresql-setup initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql

默认位置/var/lib/pgsql/{version}/data

配置

View python3.6 编译
yum install gcc openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
./configure --enable-ipv6 --enable-optimizations --with-ensurepip --enable-shared --prefix="/usr/local/python3.6.7"
# --with-optimizations --with-lto 是编译时的优化选项 --with-valgrind 不明 --prefix="/usr/local" --enable-profiling
#不指定path,安装完成后python会自动把自己加到系统目录里
sudo make -j4
sudo make install
#在/etc/ld.so.conf.d下创建python3.conf写入/usr/local/python3.6.7/lib
ldconfig
@Casxt
Casxt / opencv process to rmtp
Last active Nov 19, 2018
rstp to rmtp in python use ffmpeg
View opencv process to rmtp
pipe = subprocess.Popen([FFMPEG_BIN,
'-y', # (optional) overwrite output file if it exists
'-f', 'rawvideo',
#'-loglevel','error',
#'-probesize','10M',
'-s', framesize, #'420x360', # size of one frame
'-pix_fmt', 'bgr24',
'-r', str(self.fps), # frames per second
'-i', '-', # The input comes from a pipe
'-an', # Tells FFMPEG not to expect any audio
@Casxt
Casxt / Build Caffe with python3.6.7
Last active Nov 12, 2018
Build Caffe with python3.6.7
View Build Caffe with python3.6.7
# 编译boost
``` bash
./bootstrap.sh --with-python=/usr/local/bin/python3.6 --with-python-root=/usr/local/python3.6.7
./bootstrap.sh --with-python=/usr/local/bin/python3.6
./b2 --clean
./b2 --with-python
./b2 install --prefix=/data/zhangkai/.local/boost
```