Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .git_template/hooks/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env sh
target_file="$1"

commit_type="$2"

if [ ! -z "$commit_type" ]; then
# re-use existing commit message
exit 0
fi


existing_content=$(cat $target_file)

branch_type=$(git current | cut -d '/' -f1)

cat > $target_file <<EOF
${branch_type}[$(ticket_number)]:
${existing_content}
# generated with args: "$@"
EOF
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
config/variables
downloads/
zshrc/.zcompdump
zshrc/local-overrides
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,39 @@ If running on Windows, you might need to make sure that line endings are configu
```sh
git config --global core.autocrlf true
```

## Examples of home directory dotfiles

```sh
# .zshenv
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"
export DEBUG_SOURCED_HOME_ZSHRC="~/.zshrc at $(date -Is)"


eval "$(starship init zsh)"

# pnpm overrides for muscle memory
alias y="pnpm"
alias y+="pnpm add"
alias yd="pnpm add --save-dev"
```

```sh
# .zshrc
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"
export DEBUG_SOURCED_HOME_ZSHRC="~/.zshrc at $(date -Is)"


eval "$(starship init zsh)"

# pnpm overrides for muscle memory
alias y="pnpm"
alias y+="pnpm add"
alias yd="pnpm add --save-dev"
```

```sh
# .zprofile
BM_HELLO_NOEXPORT=hello
export BM_HELLO_EXPORT=hello
```
5 changes: 5 additions & 0 deletions bin/git-browse
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
set +e

gh repo view --web
glab repo view --web
3 changes: 2 additions & 1 deletion bin/keepdoing
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env sh
watchmedo shell-command --patterns="*.py;*.sh;*.js;*.jsx;*file" --ignore-directories --recursive --drop --command="$1"
PATTERNS=${KD_PATTERNS:-"*.py;*.sh;*.js;*.jsx;*file"}
watchmedo shell-command --patterns="$PATTERNS" --ignore-directories --recursive --drop --command="$1"
2 changes: 2 additions & 0 deletions bin/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
sensible-browser README.md
2 changes: 2 additions & 0 deletions config/.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
nicelog = !nicelog
cloc = !cloc --vcs=git
rev = !glab mr checkout
mrv = !glab mr view --web
br = !nicebranch
aliases = !git config -l | grep alias | cut -c 7-
[url "https://github.com/"]
insteadOf = hub:
[url "https://github.com/fredcollman/"]
Expand Down
2 changes: 2 additions & 0 deletions config/.tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
python 3.10.4
nodejs lts
yarn 1.22.19
pnpm 7.12.2
rust 1.66.0
terraform 1.3.6
1 change: 1 addition & 0 deletions config/local-bin
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ LOCALBIN_DIR="$HOME/.local/bin"
mkdir -p "$LOCALBIN_DIR"
ln -s `pwd`/bin/bookmark-manager.sh "$LOCALBIN_DIR/bm"
ln -s `pwd`/bin/keepdoing "$LOCALBIN_DIR/kd"
ln -s `pwd`/bin/* "$LOCALBIN_DIR"
1 change: 1 addition & 0 deletions config/nvim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fi

ln -s `pwd`/nvim/init.vim $NEOVIM_DIR/init.vim
ln -s `pwd`/nvim/lua $NEOVIM_DIR/lua
ln -s `pwd`/nvim/UltiSnips $NEOVIM_DIR/UltiSnips

git clone https://github.com/k-takata/minpac.git $NEOVIM_DIR/pack/minpac/opt/minpac
git clone --depth 1 https://github.com/wbthomason/packer.nvim $NEOVIM_PACKAGES_DIR/pack/packer/start/packer.nvim
6 changes: 6 additions & 0 deletions nvim/UltiSnips/all.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
snippet uuid
`!p import uuid
if not snip.c:
snip.rv = repr(str(uuid.uuid4()))`
endsnippet

3 changes: 3 additions & 0 deletions nvim/UltiSnips/lua.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
snippet g
vim.g.$1 = "$2"
endsnippet
6 changes: 6 additions & 0 deletions nvim/UltiSnips/snippets.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
snippet s
snippet $1
$2
`echo endsnippet`
endsnippet

33 changes: 33 additions & 0 deletions nvim/UltiSnips/typescript.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
snippet noany
// eslint-disable-next-line @typescript-eslint/no-explicit-any
endsnippet

snippet nothis
// eslint-disable-next-line class-methods-use-this
endsnippet

snippet i
import $2 from "$1";
endsnippet

snippet ir
import $1 from "./$1";
endsnippet

snippet lo
import $1 from "lodash/$1";
endsnippet

snippet d
describe('$1', () => {
it('$2', () => {
expect(1).toBe(0)
})
})
endsnippet

snippet it
it('$1', () => {
expect(1).toBe(0)
})
endsnippet
17 changes: 17 additions & 0 deletions nvim/UltiSnips/typescriptreact.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends typescript

snippet c
`!p fn = snip.basename
proptype = f"{fn}Props"
snip.rv = "\n".join([
f"interface {proptype} {{",
" todo: null",
"}",
"",
f"const {fn} = ({{todo}}: {proptype}) => {{",
" return <>TODO: {todo}</>",
"}",
"",
f"export default {fn}",
])`
endsnippet
24 changes: 18 additions & 6 deletions nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ endif
" ALE adjustments
let g:ale_fix_on_save = 1
let g:ale_fixers = {
\ 'python': ['isort', 'black', 'autoflake'],
\ 'javascript': ['prettier'],
\ 'javascriptreact': ['prettier'],
\ 'python': ['black', 'ruff'],
\ 'javascript': ['prettier', 'eslint'],
\ 'javascriptreact': ['prettier', 'eslint'],
\ 'json': ['prettier'],
\ 'css': ['prettier'],
\ 'typescript': ['prettier'],
\ 'typescriptreact': ['prettier'],
\ 'typescript': ['prettier', 'eslint'],
\ 'typescriptreact': ['prettier', 'eslint'],
\ 'elixir': ['mix_format'],
\ 'terraform': ['terraform'],
\}
Expand Down Expand Up @@ -77,6 +77,9 @@ nnoremap <leader>gb :Git blame<CR>
" MaxMEllon/vim-jsx-pretty installed via vim-polyglot
let g:vim_jsx_pretty_highlight_close_tag = 1

" https://github.com/wuelnerdotexe/vim-astro#configuration
let g:astro_typescript = 'enable'

let g:user_emmet_expandabbr_key='<C-e>'

colorscheme molokai
Expand All @@ -90,7 +93,16 @@ let g:highlightedyank_highlight_duration = 350
" fzf.vim shortcuts
" nnoremap <leader>f :GFiles<CR>
" nnoremap <leader>b :Buffers<CR>
nnoremap <leader>u :Ag <C-R><C-W>\b<CR>
nnoremap <leader>u :Rg <C-R><C-W>\b<CR>
" muscle memory: clobber Ag to use Rg instead
cabbrev Ag Rg
" and deal with casing issues
cabbrev ag Rg
nnoremap <leader>t :Tags<CR>

nnoremap <leader>a :A<CR>
nnoremap <leader>s :Estory<CR>


" navigate smoothly from terminal mode/between windows
" via https://thoughtbot.com/upcase/videos/neovim-creating-mappings-for-terminal
Expand Down
1 change: 1 addition & 0 deletions nvim/lua/fred.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ modules = {
"./plugins",
"./lsp",
"./searching",
"./snippets",
}

function _G.reload_fred_config()
Expand Down
6 changes: 5 additions & 1 deletion nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ return require('packer').startup(
use 'tpope/vim-repeat'

-- linting and fixing
use 'dense-analysis/ale'
-- use 'dense-analysis/ale'
use '~/dev/ale'


-- syntax highlighting: JSX, Jenkinsfile and more
Expand All @@ -47,6 +48,9 @@ return require('packer').startup(
-- syntax highlighting: Hashicorp Sentinel
use 'hashicorp/sentinel.vim'

-- syntax highlight: astro
use 'wuelnerdotexe/vim-astro'

-- colour scheme
use 'tomasr/molokai'

Expand Down
3 changes: 3 additions & 0 deletions nvim/lua/snippets.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vim.g.UltiSnipsExpandTrigger='<tab>'

vim.keymap.set('n', '<Leader>s', '<cmd>UltiSnipsEdit<cr>')
18 changes: 18 additions & 0 deletions scripts/brew-leaves
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env sh

# misc formulae to install
# to calculate::
#
# brew leaves

brew install \
bats-core \
exercism \
# gawk \
# lolcat \
# luajit-openresty \
# neovim \
pipx \
# ripgrep \
# tmate \
tree
1 change: 1 addition & 0 deletions scripts/gnome-extensions
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env sh
# sudo apt install chrome-gnome-shell
sudo apt install gnome-shell-extension-manager
mkdir -p downloads

curl https://extensions.gnome.org/extension-data/caffeinepatapon.info.v37.shell-extension.zip > downloads/caffeine.zip
Expand Down
6 changes: 6 additions & 0 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ scripts/cloc
scripts/neovim
scripts/python
scripts/nodejs
scripts/rust
scripts/tauri
scripts/terraform
scripts/ruby
scripts/organize
scripts/pgadmin4
scripts/brew-leaves
3 changes: 3 additions & 0 deletions scripts/organize
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
# https://github.com/tfeldmann/organize
pip install "organize-tool"
12 changes: 12 additions & 0 deletions scripts/pgadmin4
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env sh

# ref: https://www.pgadmin.org/download/pgadmin-4-apt/

# Install the public key for the repository (if not done previously):
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg

# Create the repository configuration file:
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'

# Install for both desktop and web modes:
sudo apt install pgadmin4
8 changes: 8 additions & 0 deletions scripts/ruby
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh

# https://github.com/rbenv/ruby-build/wiki#ubuntudebianmint
sudo apt-get install autoconf bison patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev uuid-dev

asdf plugin add ruby
asdf install ruby latest
asdf global ruby latest
4 changes: 4 additions & 0 deletions scripts/rust
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
asdf plugin add rust
asdf install rust latest
asdf global rust latest
10 changes: 10 additions & 0 deletions scripts/tauri
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh
# https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-linux
sudo apt install libwebkit2gtk-4.0-dev \
build-essential \
curl \
wget \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
4 changes: 4 additions & 0 deletions zshrc/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
. $ZDOTDIR/brew
. $ZDOTDIR/terraform

if [ -f $ZDOTDIR/local-overrides ]; then
. $ZDOTDIR/local-overrides
fi

# installed via fzf for vim
# . ~/.fzf.zsh

Expand Down
12 changes: 6 additions & 6 deletions zshrc/docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
alias d="docker"

# dc is already taken
alias dco="docker-compose"
alias dcof="docker-compose -f docker-compose.yml"
alias dco="docker compose"
alias dcof="docker compose -f docker-compose.yml"

alias dcu="docker-compose up"
alias dcr="docker-compose run --rm"
alias dcb="docker-compose build"
alias dcl="docker-compose logs --tail=1000 --follow"
alias dcu="docker compose up"
alias dcr="docker compose run --rm"
alias dcb="docker compose build"
alias dcl="docker compose logs --tail=1000 --follow"
2 changes: 2 additions & 0 deletions zshrc/local-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!zsh
. ~/.zshrc
3 changes: 2 additions & 1 deletion zshrc/shell
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ set -o emacs
bindkey -e

function grepp() {
ag --group -A 2 --smart-case --pager="better-less" "$@"
# ag --group -A 2 --smart-case --pager="better-less" "$@"
rg -A 2 --smart-case "$@"
}

alias "?"=grepp
2 changes: 2 additions & 0 deletions zshrc/terraform
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C $(asdf which terraform) terraform
alias tf=terraform

alias tspace=bundle exec terraspace