Skip to content

Instantly share code, notes, and snippets.

View wangshub's full-sized avatar
❤️
Good news, everyone!

Wason wangshub

❤️
Good news, everyone!
View GitHub Profile
#!/bin/bash
# 安装Zsh
sudo apt update
sudo apt install -y zsh tree
# 设置Zsh为默认Shell
sudo chsh -s $(which zsh) $USER
# 安装Oh My Zsh(使用国内镜像加速)
@wangshub
wangshub / pso_demo.py
Created February 26, 2020 12:29
粒子群优化算法 pso python 示例
# Plot particle history as animation
import numpy as np
from sko.PSO import PSO
def demo_func(x):
x1, x2 = x
reward = (x2 - 5.1 * x1**2 / (4 * np.pi ** 2) + 5 * x1 / np.pi - 6)**2 + 10 * (1 - 1 / (8 * np.pi)) * np.cos(x1) + 10
return reward
@wangshub
wangshub / ik_two_link_planar_robot.py
Created February 26, 2020 09:35
平面连杆逆运动学仿真
@wangshub
wangshub / twp_link_planar_robot.py
Created February 26, 2020 09:31
平面连杆正运动学仿真
@wangshub
wangshub / fix_zsh_history.sh
Created January 14, 2020 01:21
Fixes a corrupt .zsh_history file
#!/usr/bin/env zsh
mv ~/.zsh_history ~/.zsh_history_bad
strings ~/.zsh_history_bad > ~/.zsh_history
fc -R ~/.zsh_history
rm ~/.zsh_history_bad
@wangshub
wangshub / install-docker-tensorflow-gpu-jupyter.sh
Last active November 7, 2019 11:11
install tensorflow gpu jupyter docker env
docker run --runtime=nvidia -dt --name tf-gpu-1.14.0 -p 8888:8888 -v "$PWD":/tf tensorflow/tensorflow:1.14.0-gpu-py3-jupyter jupyter notebook --ip=0.0.0.0 --allow-root
@wangshub
wangshub / cors.nginxconf
Created August 30, 2019 08:27 — forked from pauloricardomg/cors.nginxconf
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
@wangshub
wangshub / git_toturial
Created August 13, 2019 03:07 — forked from guweigang/git_toturial
git命令大全
git init # 初始化本地git仓库(创建新仓库)
git config --global user.name "xxx" # 配置用户名
git config --global user.email "xxx@xxx.com" # 配置邮件
git config --global color.ui true # git status等命令自动着色
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global --unset http.proxy # remove proxy configuration on git
git clone git+ssh://git@192.168.53.168/VT.git # clone远程仓库
@wangshub
wangshub / sampleREADME.md
Created July 31, 2019 03:00 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

@wangshub
wangshub / client.py
Created February 16, 2019 12:20 — forked from ninedraft/README.md
Python udp broadcast client server example
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
client.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
client.bind(("", 37020))
while True:
data, addr = sock.recvfrom(1024)
print("received message: %s"%data)