Skip to content

Instantly share code, notes, and snippets.

View ionling's full-sized avatar
🍃
Having fun with nature

ionling ionling

🍃
Having fun with nature
View GitHub Profile
@lbbedendo
lbbedendo / select_last_sequence_value_pg.sql
Created October 19, 2023 17:58
Select last value of PostgreSQL sequence
SELECT last_value FROM sequence_name;
@oleksis
oleksis / v1.0.0_wsl2_wslg_display_x0.md
Last active June 15, 2024 01:17
X11 display socket in WSLg

Update to WSL2 v1.0.0

➜ wsl --shutdown
➜ wsl --update --web-download
➜ wsl --version
WSL version: 1.0.0.0
Kernel version: 5.15.74.2
WSLg version: 1.0.47
MSRDC version: 1.2.3575
@grahamking
grahamking / errs.go
Created May 22, 2020 17:09
Collect and handle multiple errors in Go
package util
import (
"errors"
"strings"
)
// Errs is an error that collects other errors, for when you want to do
// several things and then report all of them.
type Errs struct {
@embano1
embano1 / README.MD
Created September 23, 2019 14:54
Dockerfile for Go modules and built cache efficiency

Also works across git branches if you keep the intermediate build images around, e.g. those <none> images in the docker images output.

FROM golang:1.12 AS builder

# enable Go modules support
ENV GO111MODULE=on

WORKDIR $GOPATH/src/github.com/myrepo/myapp
@wweir
wweir / god
Last active June 5, 2020 11:13
利用 goproxy 加速安装 gopls 之类命令行工具,并保持开发环境整洁
#!/usr/bin/env bash
god(){
mkdir -p /tmp/god
(cd /tmp/god && go mod init god &> /dev/null)
for repo in $@; do
(cd /tmp/god && GOPROXY=${GOPROXY:-https://goproxy.cn,direct} go get $repo)
done
}
god $@
@atruskie
atruskie / terminal-keybind.ahk
Last active December 30, 2022 15:44
AutoHotkey script to bind Win+~ keyboard shortcut to Windows Terminal
#NoEnv
#SingleInstance force
SendMode Input
DetectHiddenWindows, on
SetWinDelay, 0
#`::
terminal := WinExist("ahk_exe WindowsTerminal.exe")
if (terminal)
{
@laggardkernel
laggardkernel / startup-time-of-zsh.md
Last active June 21, 2024 15:27
Comparison of ZSH frameworks and plugin managers

Comparison of ZSH frameworks and plugin managers

Changelog

  • update 1: add a FAQ section
  • update 2: benchmark chart and feature comparison table
  • update 3:
    • improve the table with missing features for antigen
    • new zplg times result

TLDR

@davecheney
davecheney / patch.diff
Created April 7, 2016 11:08
Diffy McDiffface
diff --git a/src/errors/errors.go b/src/errors/errors.go
index b8a4692..ba1e239 100644
--- a/src/errors/errors.go
+++ b/src/errors/errors.go
@@ -10,6 +10,10 @@ func New(text string) error {
return &errorString{text}
}
+type Error string
+
@oneohthree
oneohthree / quick-slugify.sh
Last active February 22, 2024 01:53
Quick bash slugify
echo "$STRING" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z
@ijy
ijy / sublime-text-3-setup.md
Last active January 15, 2024 14:21
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following: