Skip to content

Instantly share code, notes, and snippets.

@eighty4
eighty4 / flutter-git-hook.sh
Last active March 3, 2023 22:19
An appropriate pre-push Git hook for Flutter projects
#!/bin/sh
set -e
flutter test
flutter analyze
dart format lib test --set-exit-if-changed
git diff --exit-code
@eighty4
eighty4 / golang-git-hook.sh
Last active February 7, 2023 16:49
An appropriate pre-push Git hook for Golang projects
#!/bin/sh
set -e
go build .
go list -f '{{.Dir}}' -m | xargs go test
go mod tidy
git diff --exit-code
@eighty4
eighty4 / now.sh
Last active February 9, 2023 00:46
Alias for printing current time and date
alias now='echo "it'"'"'s $(date "+%H:%M") on $(date "+%-m/%-d")"'
@eighty4
eighty4 / .zshrc
Last active February 9, 2023 00:45
Clean zsh shell prompt
# %(?. . ) is a ternary on the prev process exit code
# %B starts printing bold text until %b
# %F{196} starts printing with a new foreground color until %f
# %~ prints cwd using ~ notation for home dir
# the shell does not add a space so appending a space is customary
PROMPT='%(?. .%F{196}!%f)%B%F{220}%~%f%b '
@eighty4
eighty4 / rust-git-hook.sh
Created February 25, 2023 21:27
An appropriate pre-push Git hook for Flutter projects
#!/bin/sh
set -e
cargo test
cargo clippy -- -D warnings
cargo fmt -v
git diff --exit-code
@eighty4
eighty4 / profile.ps1
Created June 1, 2023 16:03
C:\Users\<username>\Documents
New-Alias which where.exe
New-Alias python3 C:\Users\adamm\AppData\Local\Programs\Python\Python311\python.exe
@eighty4
eighty4 / .gclient
Last active June 1, 2023 16:40
For gclient syncing repos from googlesource.com. Install depot_tools, and run `gclient sync` from a directory with this .gclient file.
solutions = [
{
"name": "chromium",
"url": "https://chromium.googlesource.com/chromium/src.git",
"managed": False,
"custom_deps": {},
"custom_vars": {},
},
{ "name" : 'libyuv',
"url" : 'https://chromium.googlesource.com/libyuv/libyuv',
@eighty4
eighty4 / iso_to_usb.sh
Created July 4, 2023 06:15
Copy ISO to USB
# find USB mount
diskutil list
# unmount USB
diskutil unmountDisk /dev/disk2
# copy ISO to USB
sudo dd if=/Users/adam/Downloads/ubuntu-23.04-desktop-amd64.iso of=/dev/disk2 bs=1m
@eighty4
eighty4 / npm_publish_workflow.yaml
Last active October 22, 2023 23:24
GitHub workflow to publish to npm a prerelease @Alpha or @next version of a package
name: CI with an npm @next publish
on:
push:
branches: [ main ]
paths:
- 'ui/**/*'
pull_request:
branches: [ main ]