Skip to content

Instantly share code, notes, and snippets.

View Zensey's full-sized avatar
🎯

Anton Litvinov Zensey

🎯
View GitHub Profile
@matryer
matryer / term_context.go
Last active March 10, 2022 05:23
Making Ctrl+C termination cancel the context.Context
func main() {
ctx := context.Background()
// trap Ctrl+C and call cancel on the context
ctx, cancel := context.WithCancel(ctx)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
defer func() {
signal.Stop(c)
@zakkak
zakkak / .git-commit-template
Last active May 15, 2024 00:06 — forked from adeekshith/.git-commit-template.txt
This commit message template that helps you write great commit messages and enforce it across your team.
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@SCP002
SCP002 / init_console_handlers_windows.go
Last active November 1, 2022 20:42
Golang: Initialize console handlers after AttachConsole or AllocConsole on Windows.
// Used in https://github.com/SCP002/terminator.
package main
import (
"errors"
"os"
"golang.org/x/sys/windows"
)