HHTjim's Blog - Share&Record

Auto code Twitter pictures

Author: matrix Observed: 122 times Published on: March 26, 2024 Classification: odd | No comment »

In recent years, there has always been a flood of yellow tweets. Whether you pay attention or not, you will always see it in the comment area 😂 It would be very embarrassing to see the webpage when it is scrolled, so I simply coded all the pictures and hovered the mouse to display them. Perfect solution 🍺🍺🍺 Installation address https://greasyfork.org/zh-CN/scripts/492051-twitter-safeview-auto-blur-with-hover-reveal Script code // ==UserScript== // @name Twitter SafeView: Auto-Blur with Hover Reveal // @namespace http://hhtjim.com/ // @version 1.0 //@ description Automatically blurs all

Build the hystria2 server

Author: matrix Watched: 717 times Published on: January 31, 2024 Classification: odd | 3 comments »

Server Configuration Directory of configuration files /root/hysteria Self signed certificate key crt generation openssl req -x509 -nodes -newkey ec:<(openssl ecparam -name prime256v1) -keyout /root/hysteria/server.key -out /root/hysteria/server.crt -subj "/CN=bing.com" -days 36500 # sudo chown hysteria /root/hysteria/server.key # sudo chown hysteria /root/hysteria/server.crt Create a new hystria2.yaml file Listen:: 443 # Listening port #Use CA certificate #acme: # domains: # ......

Golang remote debugging vscode+dlv

Author: matrix Watched: 357 times Release time: December 31, 2023 Classification: Golang | One comment »

The remote environment may have remote debugging requirements, such as white list access restrictions To enable the local environment to debug remote environment data, the local code and the remote environment execution code must be consistent Install dlv Remote server environment installation dlv $ go install github.com/go-delve/delve/cmd/ dlv@latest View installed dlv version $ dlv version Delve Debugger Version: 1.21.0 Build: $Id: fec0d226b2c2cce1567d5f59169660cf61dc1efe Start the dlv service Method a Listen for started processes $ dlv attach 28122 --listen=:8669 --headless --api......

LAN game streaming tool parsec

Author: matrix Viewed: 1330 times Released on: December 5, 2023 Classification: odd | No comment »

Parsec https://Parsec.app/ Parsec is a remote desktop tool for game players, which has a good low latency experience. I use the Mac end of Parsec to connect to the PC end to play games remotely, which can completely replace Microsoft's Microsoft Remote Desktop. Although MRD can slightly optimize the network latency ($sysctl net. inet. tcp. delayed_ack=0), the effect is still unsatisfactory. When MRD is remote, the high-frequency operations of dragging windows and games can still feel significant delays. However, MRD is good for office remote. After all, it is convenient to paste and copy. register Internet access is required for login and registration

Using virtual fields in GORM

Author: matrix Observed: 265 times Published on: November 30, 2023 Classification: Golang | No comment »

When using gorm, you may need to deal with virtual fields (fields that do not actually exist in the database). The structure tag tag can be used to support User structure model type User struct { ID uint ` gorm: "primaryKey; not null" `//Primary key ID //Virtual field Isvip int ` gorm: "-; default: 0" `//Yes Vip 1 Yes 0 No } explain: IsVip field is marked as gorm: "-", indicating virtual field. Gorm will not consider this field when performing database operations (such as query, insert, update, etc.). At the same time, you can use default

ShouldBindQuery gets the default value of GET parameter

Author: matrix Observed: 706 times Release time: October 31, 2023 Classification: Golang | One comment »

Set default in the form tag of the verifier structure. Only test the effective reading of ShouldBindQuery. Other binding methods are unknown Validator structure type UserListValidator struct { Type string ` form: "type, default=RECOMMEND" binding: "omnipotence, one of=NEAR RECOMMEND" label: "list type" `//list type NEAR: near (default) RECOMMEND: recommended } Controller method func (u *UserController) List(ctx *gin.Context) { validator := validators. UserListValidator{} if err ......

JSON Merge Patch merges structure field data

Author: matrix Viewed: 404 times Release time: October 18, 2023 Classification: Golang | No comment »

Json Merge Patch is an Internet Engineering Task Force (IETF) standard. The basic idea is that you have an original JSON object, and then according to the provided "patch" JSON object, the original JSON object needs to be modified. This mechanism is applicable to partial update (also known as PATCH update) scenarios. example Original object: { "Account": "old_account", "Name": "old_name", "Avatar": "old_avatar" } Patch object: { "Account": "new_account", "Name": null } To be changed after applying the patch object

Struct structure type 2 - difference between embedded structure value pointer types

Author: matrix Observed: 2263 times Published on: July 7, 2023 Classification: Golang | 3 comments »

There are two types of embedded structures in Golang: value or pointer conclusion When creating a struct instance with an embedded pointer, you must manually declare the embedded structure pointer. The pseudo code is as follows: package main type BaseDao struct{name string} #Anonymous structure field BaseDao Type OptDao1 struct {BaseDao} # Embedded value Type OptDao2 struct {* BaseDao} # Embed pointer func main(){ Opt:=OptDao2 {BaseDao:&BaseDao {}}//The embedded structure pointer must be declared manually } In the above code, OptDao1 and OptDao2 are embedded in the BaseDao structure, with the main difference being embedded