Compare commits
4 Commits
8ddde96cd7
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d93d1bc82 | |||
| bb1e28fcb1 | |||
| 64be233740 | |||
| f0dd76f2fb |
@@ -1,12 +1,13 @@
|
|||||||
## Gregory's dotfiles
|
## Gregory's dotfiles
|
||||||
|
|
||||||
|
[What are dotfiles](https://dotfiles.github.io/)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
|
I use bash as my shell. Here is the [tree](https://git.localhots.xyz/localhots/dotfiles/src/commit/2f17a9f7300b61a382ec3dfeb69de648b3d36b43) before purging macOS and fish configs.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone git@github.com:localhots/dotfiles.git ~/dotfiles
|
git clone git@git.localhots.xyz:localhots/dotfiles.git ~/dotfiles
|
||||||
~/dotfiles/setup.bash
|
bash ~/dotfiles/setup.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### Changelog
|
|
||||||
|
|
||||||
* [Tree](https://github.com/localhots/dotfiles/tree/2f17a9f7300b61a382ec3dfeb69de648b3d36b43) before purging macOS and fish configs.
|
|
||||||
|
|||||||
+5
-3
@@ -1,6 +1,9 @@
|
|||||||
# General
|
# General
|
||||||
alias ll="ls -lAFh --color"
|
alias ll="ls -lAFh --color"
|
||||||
|
alias duh="du -hs * | sort -rh"
|
||||||
alias dedup="awk '!visited[$0]++'"
|
alias dedup="awk '!visited[$0]++'"
|
||||||
|
alias dfh="df -h | grep -v '/var/lib/docker\|/snap/\|tmpfs'"
|
||||||
|
alias ,ssh-agent-forwarding="eval \`ssh-agent\` && ssh-add ~/.ssh/id_rsa"
|
||||||
|
|
||||||
# Git
|
# Git
|
||||||
alias ga="git add -u; git add .; git status -sb"
|
alias ga="git add -u; git add .; git status -sb"
|
||||||
@@ -17,7 +20,7 @@ alias gcl="git co -"
|
|||||||
alias gml="git merge - --no-edit"
|
alias gml="git merge - --no-edit"
|
||||||
|
|
||||||
# Ruby
|
# Ruby
|
||||||
alias bd="bundle install --jobs=8"
|
alias bd="bundle install --jobs=$(getconf _NPROCESSORS_ONLN)"
|
||||||
alias bdc="bundle config set path 'vendor/bundle'"
|
alias bdc="bundle config set path 'vendor/bundle'"
|
||||||
alias b="bundle exec"
|
alias b="bundle exec"
|
||||||
alias br="bundle exec rails"
|
alias br="bundle exec rails"
|
||||||
@@ -26,6 +29,5 @@ alias br="bundle exec rails"
|
|||||||
alias goi="go install ./..."
|
alias goi="go install ./..."
|
||||||
alias gg='rg -g "*.go"'
|
alias gg='rg -g "*.go"'
|
||||||
|
|
||||||
alias ytdl="youtube-dl -f 'bestvideo+bestaudio'"
|
# Rust
|
||||||
alias cr="cargo run --quiet --"
|
alias cr="cargo run --quiet --"
|
||||||
|
|
||||||
|
|||||||
+22
-23
@@ -10,35 +10,34 @@ export LSCOLORS=Exfxcxdxbxegedabagacad
|
|||||||
|
|
||||||
export EDITOR=vim
|
export EDITOR=vim
|
||||||
export PROJECTS=$HOME/Code
|
export PROJECTS=$HOME/Code
|
||||||
|
export WORK_PROJECTS=$HOME/Code/work
|
||||||
|
|
||||||
# Go
|
# Go
|
||||||
# GOROOT can be easily derived from go binary path
|
|
||||||
# export GOROOT=$HOME/go/lang
|
# export GOROOT=$HOME/go/lang
|
||||||
export GOPATH=$HOME/go/path
|
export GOPATH=$HOME/go/path
|
||||||
|
|
||||||
source $HOME/dotfiles/bash/functions_internal.sh
|
BASHFILES=$HOME/dotfiles/bash
|
||||||
source $HOME/dotfiles/bash/history.sh
|
source $BASHFILES/functions_internal.sh
|
||||||
source $HOME/dotfiles/bash/path.sh
|
source $BASHFILES/functions.sh
|
||||||
source $HOME/dotfiles/bash/format.sh
|
source $BASHFILES/history.sh
|
||||||
source $HOME/dotfiles/bash/alias.sh
|
source $BASHFILES/path.sh
|
||||||
source $HOME/dotfiles/bash/prompt.sh
|
source $BASHFILES/format.sh
|
||||||
source $HOME/dotfiles/bash/functions.sh
|
source $BASHFILES/alias.sh
|
||||||
source $HOME/dotfiles/bash/overrides.sh
|
source $BASHFILES/prompt.sh
|
||||||
|
for f in $BASHFILES/secrets/*; do
|
||||||
for f in $HOME/dotfiles/bash/{tools,secrets}/*; do
|
|
||||||
source $f
|
source $f
|
||||||
done
|
done
|
||||||
|
|
||||||
|
case "$(uname -s)" in
|
||||||
|
Darwin) source $BASHFILES/macos.sh ;;
|
||||||
|
Linux) source $BASHFILES/linux.sh ;;
|
||||||
|
*) echo "*** Unknown system! Check dotfiles/bashrc.sh ***" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Use bash-completion, if available
|
# Use bash-completion, if available
|
||||||
[[ $PS2 && -f /usr/share/bash-completion/bash_completion ]] && \
|
if [ $PS2 ] && [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||||
. /usr/share/bash-completion/bash_completion
|
source /usr/share/bash-completion/bash_completion
|
||||||
|
fi
|
||||||
#
|
if [ $PS2 ] && [ -f $HOME/.git-completion.bash ]; then
|
||||||
# Misc
|
source $HOME/.git-completion.bash
|
||||||
#
|
fi
|
||||||
|
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
|
||||||
|
|
||||||
# Disable Ruby 2.7 deprecation warnings
|
|
||||||
# export RUBYOPT='-W:no-deprecated -W:no-experimental'
|
|
||||||
export RUBYOPT=
|
|
||||||
|
|||||||
+28
-5
@@ -2,6 +2,25 @@ function reload {
|
|||||||
source $HOME/.bashrc
|
source $HOME/.bashrc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __path_list {
|
||||||
|
IFS=':' read -ra ARY <<< "$PATH"
|
||||||
|
for DIR in "${ARY[@]}"; do
|
||||||
|
echo $DIR
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function __path_append {
|
||||||
|
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
|
||||||
|
export PATH="${PATH:+"$PATH:"}$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function __path_prepend {
|
||||||
|
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
|
||||||
|
export PATH="$1${PATH:+":$PATH"}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Count lines of code in files that are checked into the current Git repository
|
# Count lines of code in files that are checked into the current Git repository
|
||||||
function gkloc {
|
function gkloc {
|
||||||
cloc $(git ls-files)
|
cloc $(git ls-files)
|
||||||
@@ -30,13 +49,17 @@ function h { cd $HOME/$1; }
|
|||||||
function _h { __bash_directory_complete $HOME; }
|
function _h { __bash_directory_complete $HOME; }
|
||||||
complete -F _h h
|
complete -F _h h
|
||||||
|
|
||||||
function c { cd $(realpath $PROJECTS/$1); }
|
function c { cd $(realpath $WORK_PROJECTS/$1); }
|
||||||
function _c { __bash_directory_complete $PROJECTS; }
|
function _c { __bash_directory_complete $WORK_PROJECTS; }
|
||||||
complete -F _c c
|
complete -F _c c
|
||||||
|
|
||||||
function cg { cd $GOPATH/src/github.com/$1; }
|
function p { cd $(realpath $PROJECTS/$1); }
|
||||||
function _cg { __bash_directory_complete $GOPATH/src/github.com; }
|
function _p { __bash_directory_complete $PROJECTS; }
|
||||||
complete -W "$(dir -d $HOME/go/path/src/github.com/*/* | cut -d'/' -f8-)" cg
|
complete -F _p p
|
||||||
|
|
||||||
|
# function cg { cd $GOPATH/src/github.com/$1; }
|
||||||
|
# function _cg { __bash_directory_complete $GOPATH/src/github.com; }
|
||||||
|
# complete -W "$(dir -d $HOME/go/path/src/github.com/*/* | cut -d'/' -f8-)" cg
|
||||||
|
|
||||||
#
|
#
|
||||||
# Misc
|
# Misc
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
alias sysupdate="sudo pacman -Sy archlinux-keyring && sudo pacman -Su && PATH=/usr/bin:$PATH yay -Syu"
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Homebrew
|
||||||
|
__path_append "/opt/homebrew/bin"
|
||||||
|
|
||||||
|
# Node
|
||||||
|
__path_append "/opt/homebrew/opt/node@18/bin"
|
||||||
|
__path_append "/opt/homebrew/opt/libpq/bin"
|
||||||
|
|
||||||
|
# Add sublime binary directly to PATH
|
||||||
|
__path_append "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin"
|
||||||
|
|
||||||
|
# Lowercase Tailscale alias
|
||||||
|
alias tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale"
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
function htop {
|
|
||||||
__window_title "htop"
|
|
||||||
/sbin/htop
|
|
||||||
}
|
|
||||||
+10
-6
@@ -1,13 +1,17 @@
|
|||||||
# Dotfiles
|
# Dotfiles
|
||||||
export PATH=$PATH:$HOME/dotfiles/bin # Dotfiles scripts
|
__path_append "$HOME/dotfiles/bin"
|
||||||
|
|
||||||
# Ruby
|
# Ruby
|
||||||
export PATH=$HOME/.rbenv/versions/$(cat $HOME/.rbenv/version)/bin:$PATH # Gem binaries
|
# export PATH=$HOME/.rbenv/versions/$(cat $HOME/.rbenv/version)/bin:$PATH # Gem binaries
|
||||||
export PATH=$HOME/.rbenv/shims:$PATH # Gem binaries
|
# export PATH=$HOME/.rbenv/shims:$PATH # Gem binaries
|
||||||
|
|
||||||
# Go
|
# Go
|
||||||
export PATH=$HOME/go/lang/bin:$PATH # Go package binaries
|
__path_prepend "$HOME/go/lang/bin"
|
||||||
export PATH=$GOPATH/bin:$PATH # Go package binaries
|
__path_append "$GOPATH/bin"
|
||||||
|
|
||||||
# Rust
|
# Rust
|
||||||
export PATH=$PATH:$HOME/.cargo/bin
|
__path_append "$HOME/.cargo/bin"
|
||||||
|
|
||||||
|
if [ -d "$HOME/.local/bin" ]; then
|
||||||
|
__path_append "$HOME/.local/bin"
|
||||||
|
fi
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
GIT="/sbin/git"
|
GIT="$(which git)"
|
||||||
|
|
||||||
function __bash_prompt {
|
function __bash_prompt {
|
||||||
local baseDir=$(__bash_basedir)
|
local baseDir=$(__bash_basedir)
|
||||||
|
|||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DISPLAY=:0.0 xset -q | grep -q "Monitor is Off"
|
||||||
|
echo $? > $HOME/.cache/node-exporter/display-standby-state
|
||||||
|
|
||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pactl unload-module 7
|
||||||
|
pactl unload-module 8
|
||||||
|
pactl set-card-profile 0 'output:iec958-stereo+input:iec958-stereo'
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env ruby
|
|
||||||
|
|
||||||
files = `du -k -d 1`.scan(/(\d+).*\.\/(.*)/)
|
|
||||||
maxlen = files.max_by{ |f| f[1].length }[1].length
|
|
||||||
|
|
||||||
files.sort_by{ |f| f[0].to_i }.reverse.each do |f|
|
|
||||||
name = f[1]
|
|
||||||
size = f[0].to_i
|
|
||||||
|
|
||||||
print "%-#{maxlen+1}s" % name
|
|
||||||
if size < 1024
|
|
||||||
puts "#{size}K"
|
|
||||||
else
|
|
||||||
puts "#{size / 1024}M"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -14,3 +14,4 @@ vendor/gems
|
|||||||
|
|
||||||
# VSCode
|
# VSCode
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
|
.vscode
|
||||||
|
|||||||
+2
-2
@@ -21,8 +21,8 @@ include @sysconfdir@/sway/config.d/*
|
|||||||
include $HOME/.config/sway/config.d/*
|
include $HOME/.config/sway/config.d/*
|
||||||
|
|
||||||
# Color Scheme
|
# Color Scheme
|
||||||
include $HOME/.config/sway/themes/dracula2
|
# include $HOME/.config/sway/themes/dracula2
|
||||||
# include $HOME/.config/sway/themes/default
|
include $HOME/.config/sway/themes/default
|
||||||
|
|
||||||
exec wl-clipsync
|
exec wl-clipsync
|
||||||
exec mako
|
exec mako
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ output "Unknown U2790B 0x000007CE" scale 1.5
|
|||||||
# Office Dell 24"
|
# Office Dell 24"
|
||||||
# output "Dell Inc. DELL U2412M YPPY07AV1AHB" position 0 0
|
# output "Dell Inc. DELL U2412M YPPY07AV1AHB" position 0 0
|
||||||
output "Dell Inc. DELL U2421HE CD8LV83" position 0 0
|
output "Dell Inc. DELL U2421HE CD8LV83" position 0 0
|
||||||
|
|
||||||
# Office Dell 27" 1080p
|
# Office Dell 27" 1080p
|
||||||
output "Dell Inc. DELL P2719HC 6T1Y223" position 0 0
|
output "Dell Inc. DELL P2719HC 6T1Y223" position 0 0
|
||||||
|
|
||||||
# Maison n9 TV
|
|
||||||
output "Samsung Electric Company SAMSUNG 0x00000701" res 3840x2160 scale 2 position 0 0
|
|
||||||
|
|
||||||
# Current office 4K LG screen
|
# Current office 4K LG screen
|
||||||
output "LG Electronics LG HDR 4K 0x0000E7EC" position 0 0 scale 1.5 res 3840x2160
|
output "LG Electronics LG HDR 4K 0x0000E7EC" position 0 0 scale 1.5 res 3840x2160
|
||||||
|
|
||||||
|
# Maison n9 TV
|
||||||
|
output "Samsung Electric Company SAMSUNG 0x00000701" res 3840x2160 scale 2 position 0 0
|
||||||
|
# Dom Perignon TV
|
||||||
|
output "BenQ Corporation ZOWIE RL LCD 94H02169SL0" pos 4920 0 transform 270
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Autocutsel
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type = forking
|
||||||
|
Restart = on-failure
|
||||||
|
RestartSec = 10
|
||||||
|
ExecStartPre = /usr/bin/autocutsel -fork
|
||||||
|
ExecStart = /usr/bin/autocutsel -selection PRIMARY -fork
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Logs display standby state to a file
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=%h/dotfiles/bin/log-display-standby-state
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Log display standby state every minute
|
||||||
|
Requires=display-standby-state-logger.service
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
Unit=display-standby-state-logger.service
|
||||||
|
OnCalendar=*-*-* *:*:00
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Automatic display switch
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=display_switch
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
|
|
||||||
@@ -3,9 +3,10 @@ Description=swayidle: Manages lockscreen and display
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/sbin/swayidle \
|
ExecStart=/sbin/swayidle \
|
||||||
timeout 300 /home/gregory/dotfiles/bin/screens-lock \
|
timeout 300 %h/dotfiles/bin/screens-lock \
|
||||||
timeout 10 /home/gregory/dotfiles/bin/screens-off \
|
timeout 60 %h/dotfiles/bin/screens-off \
|
||||||
resume /home/gregory/dotfiles/bin/screens-on
|
resume %h/dotfiles/bin/screens-on \
|
||||||
|
before-sleep %h/dotfiles/bin/screens-lock
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=default.target
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
Description=wl-clipsync: Synchronizes primary and clipboard paste buffers
|
Description=wl-clipsync: Synchronizes primary and clipboard paste buffers
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/home/gregory/go/path/bin/wl-clipsync -i 300ms
|
ExecStart=%h/go/path/bin/wl-clipsync -i 300ms
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=default.target
|
||||||
|
|||||||
Reference in New Issue
Block a user