Skip to content

Instantly share code, notes, and snippets.

View yangyang5214's full-sized avatar
🎯
Focusing

beer yangyang5214

🎯
Focusing
View GitHub Profile
@yangyang5214
yangyang5214 / add_bson_tag.sh
Last active December 25, 2023 13:30
protoc add bson tag
#!/bin/bash
function add_tag() {
if [[ $(uname) == "Darwin" ]]; then
# macOS
sed -i '' -E 's/json:"([^"]*)"(.*)$/json:"\1" bson:"\1"\2/g' "$1"
else
# Linux
sed -i -E 's/json:"([^"]*)"(.*)$/json:"\1" bson:"\1"\2/g' "$1"
@yangyang5214
yangyang5214 / centos_install_python.md
Created December 22, 2023 03:32
centos install python
yum -y groupinstall "Development Tools"
yum -y install gcc openssl-devel bzip2-devel libffi-devel

wget https://www.python.org/ftp/python/x.x.x/Python-x.x.x.tgz
tar -zxvf xxxx.tgz


cd python.x.x.x
@yangyang5214
yangyang5214 / centos_down_chrome.md
Created December 19, 2023 02:28
centos down chrome
touch /etc/yum.repos.d/google-chreom.repo

[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
@yangyang5214
yangyang5214 / rgba_to_hex.go
Last active December 18, 2023 12:20
color.RGBA to hex
import "image/color"
func ColorToHex(c color.Color) string {
r, g, b, _ := c.RGBA()
return fmt.Sprintf("#%02X%02X%02X", r>>8, g>>8, b>>8)
}
@yangyang5214
yangyang5214 / add cpd cmd.md
Created November 10, 2023 06:39
support cp file:///Users/xxx/xxxx/xxx file

支持快捷复制 file:///Users/xxx/Pictures/Photos%20Library.photoslibrary/private/com.apple.Photos/ExternalEditSessions/28774CA9-3961-4284-B01E-10EBA01C43B6/IMG_9750.png

  • vim .zshrc
cpd() {
  if [ -z "$1" ] || [ -z "$2" ]; then
 echo "Usage: cpd  "
@yangyang5214
yangyang5214 / 合并轨迹.md
Last active November 8, 2023 02:47
合并轨迹

用于长途骑行或者徒步,记录了几天的数据,最终整合到一个记录里。

gpx merge 微信小程序

  • 下载 gpx 文件,发送到文件传输助手
  • 上传 & 合并
  • 下载
@yangyang5214
yangyang5214 / neo4j install apoc with docker.md
Created November 2, 2023 08:56
neo4j install apoc with docker

docker run neo4j

  • install
cd /data/neo4j/data
mkdir plugins

pushd plugins
@yangyang5214
yangyang5214 / neo4j create or merge relationship.md
Created November 2, 2023 08:46
neo4j create or merge relationship
@yangyang5214
yangyang5214 / rdp_auth_ssl.md
Created June 25, 2023 11:22
windows rdp 服务自定义证书

rdp 服务自定义证书

生成 out.pfx 证书文件

openssl pkcs12 -export -out out.pfx -inkey nginx-selfsigned.key -in nginx-selfsigned.crt
@yangyang5214
yangyang5214 / create_windows_user.go
Created June 25, 2023 06:39
create windows user
func (s *CmdService) AddUser(c *gin.Context) {
username := c.Query("user")
password := c.Query("pwd")
command := exec.Command("cmd.exe ", "/c", "net", "user", username, password, "/add")
err := command.Run()
if err != nil {
c.String(http.StatusAccepted, "add user error")
return
}
command = exec.Command("cmd.exe", "/c", "net", "localgroup", "Remote Desktop Users", username, "/add")