go banner

How to Add Multiple Tags to Go Struct

It is easy but always be forgotten, so write this post Incorrect type Page struct { PageId string `bson:"pageId",json:"pageId"` Meta map[string]interface{} `bson:"meta",json:"pageId"` } Correct type Page struct { PageId string `bson:"pageId" json:"pageId"` Meta map[string]interface{} `bson:"meta" json:"pageId"` } More tags Items []Item `gorm:"column:items,type:varchar(255);comment:'sample column'" json:"items"` Links StackOverflow - How to define multiple name tags in a struct

February 26, 2023 · Aimer Neige
KVM Logo

Install kvm on Fedora

KVM: Kernel-Based Virtual Machine Products Company VirtualBox Oracle VMWare VMWare Hyper-V Microsoft First, use x86 laptop or pc. # check if kvm avaiable (output should bigger than 0) egrep -c '(vmx|svm)' /proc/cpuinfo if output is 0, enable vt on BIOS. Install KVM on fedora36 # Install required virtualization packages sudo dnf -y install bridge-utils libvirt virt-install qemu-kvm # Also install useful tools for virtual machine management sudo dnf -y install libvirt-devel virt-top libguestfs-tools guestfs-tools qemu-kvm: the emulator itself libvirt-daemon: runs virtualization in background birdge-utils: important networking dependencies virt-manager: the graphical program we’ll use to work with our VMs sudo usermod -aG libvirt aimer sudo usermod -aG kvm aimer sudo systemctl start libvirtd sudo systemctl enable libvirtd Virtual Machine Manager (or “virt-manager”) ...

February 25, 2023 · Aimer Neige
eEFInd logo

Install rEFInd on Fedora

rEFInd on Fedora Install Obtain an rEFInd binary for RPM based system. direct link (not the newest) Find the newest rpm package download link from here. After you download a rpm package, install it with your package manager sudo dnf install refind-0.6.11-1.x86_64.rpm sudo rpm -Uvh refind-0.6.11-1.x86_64.rpm sudo yum localinstall refind-0.6.11-1.x86_64.rpm At the most of the time, your are ready to use rEFInd, if it did not work on your system, run refind-install: ...

November 20, 2022 · Aimer Neige
OneDrive Logo

OneDrive on Linux

OneDrive on Linux Install sudo dnf install onedrive Login [user@hostname ~]$ onedrive Authorize this app visiting: https://..... Enter the response uri: Copy the url from browser like this: https://login.microsoftonline.com/common/oauth2/nativeclient?code=<redacted> Paste it into terminal then press enter: The Final result will like this: [user@hostname ~]$ onedrive Authorize this app visiting: https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=22c49a0d-d21c-4792-aed1-8f163c982546&scope=Files.ReadWrite%20Files.ReadWrite.all%20Sites.ReadWrite.All%20offline_access&response_type=code&redirect_uri=https://login.microsoftonline.com/common/oauth2/nativeclient Enter the response uri: https://login.microsoftonline.com/common/oauth2/nativeclient?code=<redacted> Application has been successfully authorized, however no additional command switches were provided. Please use 'onedrive --help' for further assistance in regards to running this application. Configuration Show your configuration: ...

November 20, 2022 · Aimer Neige
Samba Logo

Install and Configure Samba

SMB File Share Update System sudo apt update Install Samba sudo apt install samba Edit Share Config sudo vim /etc/samba/smb.conf Add share point at the end of the config file [share-name] comment = Your Comment Here path = /path/to/share/dir read only = no browsable = yes [public] comment = Public Shared Disk path = /mnt/disk/smb/share read only = no browsable = yes create mask = 0644 directory mask = 0755 [private] comment = Pricate Data Share path = /mnt/disk/smb/private read only = no browsable = no valid user = aimer, umb create mask = 0644 directory mask = 0755 [media] comment = Media Files path = /media read only = yes browsable = yes Start Samba sudo systemctl start smbd.service Enable Autostart sudo systemctl enable smbd.service Update Firewall Rules sudo ufw allow samba Setting User Password sudo smbpasswd -a username Warning ...

November 20, 2022 · Aimer Neige
Ubuntu Filebrowser

Install Filebrowser on Ubuntu Server

Install Filebrowser Install file browser to your server: curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash Have a quick test: filebrowser -a 0.0.0.0 -r /path/to/your/files Access your server and try to login in. Username: admin Password: admin Create Your Own Config Write your config file: sudo mkdir /etc/filebrowser/ sudo vim /etc/filebrowser/.filebrowser.yaml Write something like this: port: 8080 address: 0.0.0.0 root: /path/to/your/file database: /etc/filebrowser/filebrowser.db Create Service Write a service file: sudo vim /etc/systemd/system/filebrowser.service Write something like this: [Unit] Description=File Browser Service After=network.target [Service] Type=simple Restart=on-failure RestartSec=5s ExecStart=filebrowser [Install] WantedBy=multi-user.target Start and enable it: ...

November 18, 2022 · Aimer Neige
Ubuntu qBittorrent-nox

Install qBittorrent-nox on Ubuntu Server

Install qBittorrent-nox on Ubuntu Server Update ubuntu sudo apt update && sudo apt upgrade -y Import qBittorrent-nox Stable sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable -y Import qBittorrent-nox Unstable (Nightly) sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-unstable -y Reflect the newly added PPA sudo apt update Install qBittorrent-nox sudo apt install qbittorrent-nox -y Create usergroup sudo adduser --system --group qbittorrent-nox # on fedora sudo groupadd qbittorrent-nox Add you to usergroup sudo adduser your-username qbittorrent-nox # on fedora sudo usermod -aG qbittorrent-nox your-username Create a systemd service file sudo vim /etc/systemd/system/qbittorrent-nox.service [Unit] Description=qBittorrent Command Line Client After=network.target [Service] Type=forking User=qbittorrent-nox Group=qbittorrent-nox UMask=022 ExecStart=/usr/bin/qbittorrent-nox -d --webui-port=8080 Restart=on-failure [Install] WantedBy=multi-user.target Reload systemctl sudo systemctl daemon-reload Start qBittorrent-nox sudo systemctl start qbittorrent-nox Enable qBittorrent-nox sudo systemctl enable qbittorrent-nox Check if qBittorrent-nox start systemctl status qbittorrent-nox Login in to your qBittorrent-nox Item Value username admin password adminadmin How to Remove qBittorrent-nox # Remove qBittorrent Stable sudo add-apt-repository --remove ppa:qbittorrent-team/qbittorrent-stable # Remove qBittorrent Unstable (Nightly) sudo add-apt-repository --remove ppa:qbittorrent-team/qbittorrent-unstable -y # Remove qBittorrent sudo apt autoremove qbittorrent-nox

November 11, 2022 · Aimer Neige
Fedora WeChat

Install WeChat on Fedora

Install WeChat on Fedora Install Wine sudo dnf install wine Adjust DPI Config Use bellow command to open winecfg winecfg Adjust the dpi to a suitable value at tab Graphics. (4k monitor, 192 dpi) Download And Config Fonts Run the following commands sudo dnf install cabextract sudo dnf install winetricks winetricks corefonts gdiplus riched20 riched30 Download & Install WeChat Just download the exe Installer. (Same with download it from browser.) ...

November 10, 2022 · Aimer Neige
Rust Logo

[Reproduce] Learning Rust in 2022

This article are reproduce from pretzelhammer/rust-blog Intro When I started learning Rust I made the mistake of following the advice to read The Book first. While it’s a great resource, it’s pretty overwhelming for a beginner to get told “If you’d like to learn this programming language the best way to start is to read this 20 chapter book!” Most people give up before they even get started when they get advice like this. Nobody ever told someone to read a 20 chapter book just to get started with Javascript or Python. Rust’s learning curve is no joke but you gotta give the people what they want, and they want to program, not read about programming. Programming is fun and reading about programming is not as fun. ...

June 29, 2022 · Aimer Neige
wsl play-store magisk

Install WSA With Google Play Store and Root

Install Uninstall old wsa (if you have) make sure you have Virtual Machine Platform enabled on Turn Windows features on or off fork this repo: https://github.com/LSPosed/MagiskOnWSA build it with actions download build result run the install script start the wsa and enjoy it Enable usb debug Open wsa settings, enable Developer Mode copy wsa ip address adb connect WSA-IP-ADDRESS

May 17, 2022 · Aimer Neige