Skip to content

Instantly share code, notes, and snippets.

  • Container-aware GOMAXPROCS
  • New experimental garbage collector (~ 10—40% reduction in garbage collection overhead)
  • fixes a compiler bug, introduced in Go 1.21, that could incorrectly delay nil pointer checks
  • go build -asan option now defaults to doing leak detection at program exit
  • Faster slices
  • go vet command includes new analyzers
  • go.mod ignore directive
  • go doc -http
  • The go command now supports using a subdirectory of a repository as the path for a module root, when resolving a module path using the syntax `` to indicate that the root-path corresponds to the subdir of the repo-url with version control system vcs.
@fillest
fillest / better-than-bash-scripts.py
Last active March 5, 2025 17:39
No more unmaintainable error-prone Bash scripts - use this instead
# Bash really should be avoided as much as possible (within reasonable limits, of course) even for one-liners which *seem* trivial.
# Bash is very error-prone by design. It's hard to comprehend all the pitfalls (e.g. https://mywiki.wooledge.org/BashFAQ/105)
# and it's a regrettable time-waste anyway.
#
# Modern Python is good for scripting the logic - keep Bash only for launching executables and most primitive
# pipes and redirections (avoid subshells, substitutions and so on). No need to install anything -
# just start your script with the following small self-contained helper function (check the examples for usage). Its features:
# * terminates on non-zero exit status by default
# * returns the output (combined - which usually should not be a problem - use e.g. '2>/dev/null' when it is)
# * prints commands and combined output

grouped by versions in an ascending order.
most important is marked with bold.


(https://docs.python.org/3/whatsnew/3.0.html)

  • binary data and Unicode
    Python 3.0 uses the concepts of text and (binary) data.
    All text is Unicode ("...")
    b"..." literals for binary data.
#!/usr/bin/env bash
set -xeuo pipefail
if [ ! -d somedir ]; then echo "..."; else true; fi
for fpath in some/path/*; do cat $fpath; echo; done > some/file
python3 -m venv venv
venv/bin/pip install -U pip
venv/bin/pip install -U setuptools wheel
venv/bin/pip freeze --all | grep -v pkg-resources
import argparse
cli_parser = argparse.ArgumentParser()
cli_parser.add_argument('--smth-str', default = 'val', help = "")
cli_parser.add_argument('-n', type = int, default = 2, choices = [1, 2, 3])
cli_parser.add_argument('-o', '--optional-smth', action = 'store_true')
func PanicOn(err error) {
if err != nil {
panic(err)
}
}
multilineStr := `line1
line2`
//tmp avoid "unused"