滚熊博客

滚熊博客

Thoughts, rants and discoveries on software development and related stuff.

我的 Mac常用软件

·Mac

我使用的一些软件工具. 软件 Raycast - Alfred 替代 Snipaste - 截图 DeepL - 翻译 Bob - mac 平台翻译和 OCR 软件(支持插件) Spark - 邮件 Rectangle - 窗口管理 Stats - iStats menu 替代 Hidden Bar - mac 顶部图标折叠 Sequel Ace - MySQL GUI Medis - Redis GUI SwitchHosts - hosts 管理切换 编辑器 Goland - go 语言 VS Code - 其他语言 命令行工具 Warp - iTerm2 替代, 现代化的命令行软件 zsh - shell starship - shell prompt zinit - zsh 插件管理 fd - find alternative bat - cat alternative lsd - ls alternative taskfile - makefile alternative ripgrep - 文本搜索, grep 加强版 direnv - 自动载入 .envrc 环境变量 fzf - 文件名模糊搜索 mcfly - shell history 智能搜索 zoxide - z 智能目录跳转 delta -

Read More →
#software#macos

npm国内镜像加速

·Linux

在使用npm过程中经常会遇到无法下载包的问题,本人在这里整理了几个npm使用国内镜像加速的方法,希望对大家有所帮助。 一、修改成腾讯云镜像源 1、命令 npm config set registry http://mirrors.cloud.tencent.com/npm/ 验证命令 npm config get registry 如果返回 http://mirrors.cloud.tencent.com/npm/,说明镜像配置成功。 二、修改成淘宝镜像源 命令 npm config set registry https://registry.npmmirror.com 验证命令 npm config get registry 如果返回 https://registry.npmmirror.com,说明镜

Read More →
#npm

Arch 安装及初始化配

·Linux

调整控制台字体(可选) 终端字体以大号字体显示 setfont ter-132n 无线连接 iwd: iNet wireless daemon iwctl device list # <name> 为 device list 打印列表你中的名字,如 `station wlan0 scan` station <name> scan station <name> get-networks # <ssid> 为 wifi名称 station <name> connect <ssid> quit # 测试网络连接 ping gnux.cn ssh 安装 (可选) 以远控安装, cv用起来~远控安装时建议目标机器一直处于 ping 状态OpenSSH # openssh 在安装环境下已经预置了,不需要再安装, 验证 `pacman -Qi openssh` # pacman -Syy openssh # 启动服务 systemctl start sshd # 查看 ip ip addr ssh 连接 # 另一台电脑 提示输入密码为前面设置的 root 密码 # <ip> 为上面

Read More →
#arch

macOS 清除 Launchpad 中的无用图标

·Macos

首先备份找到的数据库文件, 然后再操作 有些已经卸载的application在MAC launchpad (苹果启动台)无法删除: 方法一:Terminal删除 通过命令行删除图标,分步骤: 进入到/private/var/folders目录 cd /private/var/folders 搜索com.apple.dock.launchpad/db cd $(sudo find . -name "com.apple.dock.launchpad")/db 查找确认删除项目 sqlite3 db "select item_id,title from apps;" 删除启动台图标 sqlite3 db "delete from apps where title='要删除的application名称&#

Read More →
#macos

如何升级Golang依赖项

·Golang

无论您是否使用Go modules,通过使用go get 命令升级Go 依赖项都是一项基本的工作。 下面是几个如何升级Go modules的示例。 如何将依赖项升级到最新版本 该命令最终将更新您的go.mod和go.sum文件 go get example.com/pkg 如何将依赖项及其所有依赖项升级到最新版本 类似地,如果需要将单个依赖项及其所有子依赖项升级到最新版本 go get -u example.com/pkg 如何查看可用的依赖项升级 查看所有直接和间接依赖项的可用次要升级和修补程序升级 go list -u

Read More →
#golang

FIX - gpg failed to sign the data fatal: failed to write commit object

·Macos

For MacOS | Mojave | High Sierra | BigSur | Monterey Step 1 - Upgrade current gpg brew upgrade gnupg Step 2 - Install pinentry-mac brew install pinentry-mac Step 3 - Update gpg-agent.conf echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf Step 4 - Restart gpg-agent killall gpg-agent && gpg-agent --daemon Step 5 - Configure git to use GPG git config --global gpg.program gpg git config --global commit.gpgsign true

Read More →
#linux#gpg

golang中var、make、new的使用[转]

·Golang

一、var、make、new、:=的使用习惯: 1.使用make(),来初始化slice,map 和channel 。 2.大多数场合,类型明确的场合下,使用短变量声明方式:=。 3.当使用文字方式初始化一个变量,并且需要指明类型时,使用var变量声明方式。 4.避免使用new(),除非你需要一个指针变量。 注意点: make 返回值是: 引用类型本身。 new 返回值: 指向类型的指针。 二、详细对比: new 定义: func new(Type) *Type 特点: 分配内存、

Read More →
#golang#学习笔记

Uninstall nix on MacOS

·Linux

要在 Mac OS 上卸载 nix,请完成以下步骤:: Step 1: 编辑 /etc/zshrc 和/etc/bashrc 并删除以下行 sourcing nix-daemon.sh #Nix if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' fi # End Nix 如果 zshrc 和 bashrc 这两个文件在安装 Nix 后没有改变,你可以简单地将它们作为备份。 最新的安装程序还会运行初步检查以进行验证。 sudo mv /etc/zshrc.backup-before-nix /etc/zshrc sudo mv etc/bashrc.backup-before-nix /etc/bashrc Step 2: 使用 sudo vifs 编辑 fstab 以删除在 /nix 上安装 Nix 存储卷的行,如下所示,LABEL=Nix\040stORE /nix apfs rw,nobrowse。 这将防止自动挂载 Nix 存储卷 Step 3: 编辑 /etc/synthetic.conf 以

Read More →
#macos#nginx#uninstall

How to look at the stack with gdb

·Linux

I was chatting with someone yesterday and they mentioned that they don’t really understand exactly how the stack works or how to look at it. So here’s a quick walkthrough of how you can use gdb to look at the stack of a C program. I think this would be similar for a Rust program, but I’m going to use C because I find it a little simpler for a toy example and also you can do Terrible Things in C more easily. our test program Here’s a simple C program that declares a few variables and reads two strings from standard input. One of the strings is on the heap, and one is on the stack. #include <stdio.h> #include <stdlib.h> int main() { char stack_string[10] = "stack"; int x = 10; char *heap_string; heap_string = malloc(50); printf("Enter a string for the stack: "); gets(stack_string); printf("Enter a string for the heap: "); gets(heap_string); printf("Stack string is: %s\n", stack_string); printf("Heap string is: %s\n", heap_string); printf("x is: %d\n", x); } This program uses the extremely unsafe function gets which you should never use, but that’s on purpose – we learn more when things go wrong. step 0: compile the program. We can compile it with gcc -g -O0 test.

Read More →
#gdb#stack

Building cgit on macOS

·Linux

Checkout and init the submodule. git clone git://git.zx2c4.com/cgit cd cgit git submodule init git submodule update Install gettext through brew. brew install gettext Then create a cgit.conf file and set complier/linker flags to use the gettext library installed before. CFLAGS = -g -O2 -Wall -I/usr/local/opt/gettext/include LDFLAGS = -L/usr/local/opt/gettext/lib Finish up with a simple make command. make

Read More →
#cgit#macos