Compare commits
4 Commits
8ddde96cd7
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d93d1bc82 | |||
| bb1e28fcb1 | |||
| 64be233740 | |||
| f0dd76f2fb |
@@ -1,12 +1,13 @@
|
||||
## Gregory's dotfiles
|
||||
|
||||
[What are dotfiles](https://dotfiles.github.io/)
|
||||
|
||||
### 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
|
||||
git clone git@github.com:localhots/dotfiles.git ~/dotfiles
|
||||
~/dotfiles/setup.bash
|
||||
git clone git@git.localhots.xyz:localhots/dotfiles.git ~/dotfiles
|
||||
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
|
||||
alias ll="ls -lAFh --color"
|
||||
alias duh="du -hs * | sort -rh"
|
||||
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
|
||||
alias ga="git add -u; git add .; git status -sb"
|
||||
@@ -17,7 +20,7 @@ alias gcl="git co -"
|
||||
alias gml="git merge - --no-edit"
|
||||
|
||||
# Ruby
|
||||
alias bd="bundle install --jobs=8"
|
||||
alias bd="bundle install --jobs=$(getconf _NPROCESSORS_ONLN)"
|
||||
alias bdc="bundle config set path 'vendor/bundle'"
|
||||
alias b="bundle exec"
|
||||
alias br="bundle exec rails"
|
||||
@@ -26,6 +29,5 @@ alias br="bundle exec rails"
|
||||
alias goi="go install ./..."
|
||||
alias gg='rg -g "*.go"'
|
||||
|
||||
alias ytdl="youtube-dl -f 'bestvideo+bestaudio'"
|
||||
# Rust
|
||||
alias cr="cargo run --quiet --"
|
||||
|
||||
|
||||
+22
-23
@@ -10,35 +10,34 @@ export LSCOLORS=Exfxcxdxbxegedabagacad
|
||||
|
||||
export EDITOR=vim
|
||||
export PROJECTS=$HOME/Code
|
||||
export WORK_PROJECTS=$HOME/Code/work
|
||||
|
||||
# Go
|
||||
# GOROOT can be easily derived from go binary path
|
||||
# export GOROOT=$HOME/go/lang
|
||||
export GOPATH=$HOME/go/path
|
||||
|
||||
source $HOME/dotfiles/bash/functions_internal.sh
|
||||
source $HOME/dotfiles/bash/history.sh
|
||||
source $HOME/dotfiles/bash/path.sh
|
||||
source $HOME/dotfiles/bash/format.sh
|
||||
source $HOME/dotfiles/bash/alias.sh
|
||||
source $HOME/dotfiles/bash/prompt.sh
|
||||
source $HOME/dotfiles/bash/functions.sh
|
||||
source $HOME/dotfiles/bash/overrides.sh
|
||||
|
||||
for f in $HOME/dotfiles/bash/{tools,secrets}/*; do
|
||||
BASHFILES=$HOME/dotfiles/bash
|
||||
source $BASHFILES/functions_internal.sh
|
||||
source $BASHFILES/functions.sh
|
||||
source $BASHFILES/history.sh
|
||||
source $BASHFILES/path.sh
|
||||
source $BASHFILES/format.sh
|
||||
source $BASHFILES/alias.sh
|
||||
source $BASHFILES/prompt.sh
|
||||
for f in $BASHFILES/secrets/*; do
|
||||
source $f
|
||||
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
|
||||
[[ $PS2 && -f /usr/share/bash-completion/bash_completion ]] && \
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
|
||||
#
|
||||
# Misc
|
||||
#
|
||||
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
# Disable Ruby 2.7 deprecation warnings
|
||||
# export RUBYOPT='-W:no-deprecated -W:no-experimental'
|
||||
export RUBYOPT=
|
||||
if [ $PS2 ] && [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
source /usr/share/bash-completion/bash_completion
|
||||
fi
|
||||
if [ $PS2 ] && [ -f $HOME/.git-completion.bash ]; then
|
||||
source $HOME/.git-completion.bash
|
||||
fi
|
||||
|
||||
+28
-5
@@ -2,6 +2,25 @@ function reload {
|
||||
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
|
||||
function gkloc {
|
||||
cloc $(git ls-files)
|
||||
@@ -30,13 +49,17 @@ function h { cd $HOME/$1; }
|
||||
function _h { __bash_directory_complete $HOME; }
|
||||
complete -F _h h
|
||||
|
||||
function c { cd $(realpath $PROJECTS/$1); }
|
||||
function _c { __bash_directory_complete $PROJECTS; }
|
||||
function c { cd $(realpath $WORK_PROJECTS/$1); }
|
||||
function _c { __bash_directory_complete $WORK_PROJECTS; }
|
||||
complete -F _c c
|
||||
|
||||
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
|
||||
function p { cd $(realpath $PROJECTS/$1); }
|
||||
function _p { __bash_directory_complete $PROJECTS; }
|
||||
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
|
||||
|
||||
@@ -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
|
||||
export PATH=$PATH:$HOME/dotfiles/bin # Dotfiles scripts
|
||||
__path_append "$HOME/dotfiles/bin"
|
||||
|
||||
# Ruby
|
||||
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/versions/$(cat $HOME/.rbenv/version)/bin:$PATH # Gem binaries
|
||||
# export PATH=$HOME/.rbenv/shims:$PATH # Gem binaries
|
||||
|
||||
# Go
|
||||
export PATH=$HOME/go/lang/bin:$PATH # Go package binaries
|
||||
export PATH=$GOPATH/bin:$PATH # Go package binaries
|
||||
__path_prepend "$HOME/go/lang/bin"
|
||||
__path_append "$GOPATH/bin"
|
||||
|
||||
# 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 {
|
||||
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
|
||||
*.code-workspace
|
||||
.vscode
|
||||
|
||||
+2
-2
@@ -21,8 +21,8 @@ include @sysconfdir@/sway/config.d/*
|
||||
include $HOME/.config/sway/config.d/*
|
||||
|
||||
# Color Scheme
|
||||
include $HOME/.config/sway/themes/dracula2
|
||||
# include $HOME/.config/sway/themes/default
|
||||
# include $HOME/.config/sway/themes/dracula2
|
||||
include $HOME/.config/sway/themes/default
|
||||
|
||||
exec wl-clipsync
|
||||
exec mako
|
||||
|
||||
@@ -12,13 +12,13 @@ output "Unknown U2790B 0x000007CE" scale 1.5
|
||||
# Office Dell 24"
|
||||
# output "Dell Inc. DELL U2412M YPPY07AV1AHB" position 0 0
|
||||
output "Dell Inc. DELL U2421HE CD8LV83" position 0 0
|
||||
|
||||
# Office Dell 27" 1080p
|
||||
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
|
||||
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]
|
||||
ExecStart=/sbin/swayidle \
|
||||
timeout 300 /home/gregory/dotfiles/bin/screens-lock \
|
||||
timeout 10 /home/gregory/dotfiles/bin/screens-off \
|
||||
resume /home/gregory/dotfiles/bin/screens-on
|
||||
timeout 300 %h/dotfiles/bin/screens-lock \
|
||||
timeout 60 %h/dotfiles/bin/screens-off \
|
||||
resume %h/dotfiles/bin/screens-on \
|
||||
before-sleep %h/dotfiles/bin/screens-lock
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Description=wl-clipsync: Synchronizes primary and clipboard paste buffers
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/gregory/go/path/bin/wl-clipsync -i 300ms
|
||||
ExecStart=%h/go/path/bin/wl-clipsync -i 300ms
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
Reference in New Issue
Block a user