mirror of
https://github.com/acedanger/shell.git
synced 2025-12-05 22:50:18 -08:00
Refactor repository structure and add new features
- Reorganized repository structure by moving dotfiles into a dedicated subdirectory - Updated bootstrap.sh and setup.sh scripts to reference the new file paths - Fixed Nala repository GPG key setup to use gpg --dearmor for proper key format - Added Lazydocker installation to the setup script for Docker management - Updated README.md with references to new paths and additional features - Added documentation for Lazydocker in the dotfiles README.md - Updated all symlink paths to point to the new dotfiles location
This commit is contained in:
16
dotfiles/.gitconfig
Normal file
16
dotfiles/.gitconfig
Normal file
@@ -0,0 +1,16 @@
|
||||
[credential "https://github.com"]
|
||||
helper =
|
||||
helper = !/usr/bin/gh auth git-credential
|
||||
[credential "https://gist.github.com"]
|
||||
helper =
|
||||
helper = !/usr/bin/gh auth git-credential
|
||||
[user]
|
||||
email = peter@peterwood.dev
|
||||
name = Peter Wood
|
||||
[pull]
|
||||
rebase = false
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[core]
|
||||
autocrlf = input
|
||||
eol = lf
|
||||
3
dotfiles/.nanorc
Normal file
3
dotfiles/.nanorc
Normal file
@@ -0,0 +1,3 @@
|
||||
set linenumbers
|
||||
set softwrap
|
||||
set atblanks
|
||||
29
dotfiles/.profile
Normal file
29
dotfiles/.profile
Normal file
@@ -0,0 +1,29 @@
|
||||
# ~/.profile: executed by the command interpreter for login shells.
|
||||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||
# exists.
|
||||
# see /usr/share/doc/bash/examples/startup-files for examples.
|
||||
# the files are located in the bash-doc package.
|
||||
|
||||
# the default umask is set in /etc/profile; for setting the umask
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/bin" ] ; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
nvm use stable
|
||||
113
dotfiles/.zshrc
Normal file
113
dotfiles/.zshrc
Normal file
@@ -0,0 +1,113 @@
|
||||
# If you come from bash you might have to change your $PATH.
|
||||
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
||||
export PATH=$PATH:$HOME/.local/bin
|
||||
|
||||
# Path to your oh-my-zsh installation.
|
||||
export ZSH="/home/acedanger/.oh-my-zsh"
|
||||
|
||||
# Set name of the theme to load --- if set to "random", it will
|
||||
# load a random theme each time oh-my-zsh is loaded, in which case,
|
||||
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
||||
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
|
||||
ZSH_THEME="agnoster"
|
||||
|
||||
# Uncomment the following line to use hyphen-insensitive completion.
|
||||
# Case-sensitive completion must be off. _ and - will be interchangeable.
|
||||
HYPHEN_INSENSITIVE="true"
|
||||
|
||||
# Uncomment the following line to disable bi-weekly auto-update checks.
|
||||
# DISABLE_AUTO_UPDATE="true"
|
||||
|
||||
# Uncomment the following line to automatically update without prompting.
|
||||
# DISABLE_UPDATE_PROMPT="true"
|
||||
|
||||
# Uncomment the following line if pasting URLs and other text is messed up.
|
||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
||||
|
||||
# Uncomment the following line to disable colors in ls.
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment the following line to disable auto-setting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment the following line to enable command auto-correction.
|
||||
# ENABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
|
||||
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
|
||||
# COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment the following line if you want to disable marking untracked files
|
||||
# under VCS as dirty. This makes repository status check for large repositories
|
||||
# much, much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Standard plugins can be found in $ZSH/plugins/
|
||||
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
plugins=(git zsh-autosuggestions zsh-syntax-highlighting docker docker-compose zsh-you-should-use z ssh)
|
||||
|
||||
export ZSH_COMPDUMP=$ZSH/cache/.zcompdump-$HOST
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# Initialize zoxide
|
||||
eval "$(zoxide init zsh)"
|
||||
|
||||
# User configuration
|
||||
# export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
# You may need to manually set your language environment
|
||||
# export LANG=en_US.UTF-8
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
# if [[ -n $SSH_CONNECTION ]]; then
|
||||
# export EDITOR='vim'
|
||||
# else
|
||||
# export EDITOR='mvim'
|
||||
# fi
|
||||
|
||||
# Compilation flags
|
||||
# export ARCHFLAGS="-arch x86_64"
|
||||
|
||||
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
||||
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
||||
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
||||
# For a full list of active aliases, run `alias`.
|
||||
|
||||
# Load custom aliases
|
||||
if [ -f "$ZSH_CUSTOM/aliases.zsh" ]; then
|
||||
source "$ZSH_CUSTOM/aliases.zsh"
|
||||
fi
|
||||
|
||||
# set directory to home
|
||||
cd ~
|
||||
|
||||
if [ -x /usr/games/cowsay -a -x /usr/games/fortune -a -x /usr/games/lolcat ]; then
|
||||
fortune -s | cowsay | lolcat
|
||||
fi
|
||||
|
||||
# NVM configuration
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
|
||||
# Automatically use node version specified in .nvmrc if present
|
||||
autoload -U add-zsh-hook
|
||||
load-nvmrc() {
|
||||
local nvmrc_path="$(nvm_find_nvmrc)"
|
||||
if [ -n "$nvmrc_path" ]; then
|
||||
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
|
||||
if [ "$nvmrc_node_version" = "N/A" ]; then
|
||||
nvm install
|
||||
elif [ "$nvmrc_node_version" != "$(nvm version)" ]; then
|
||||
nvm use
|
||||
fi
|
||||
elif [ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ] && [ "$(nvm version)" != "$(nvm version default)" ]; then
|
||||
nvm use default
|
||||
fi
|
||||
}
|
||||
add-zsh-hook chpwd load-nvmrc
|
||||
load-nvmrc
|
||||
|
||||
[[ -s /home/acedanger/.autojump/etc/profile.d/autojump.sh ]] && source /home/acedanger/.autojump/etc/profile.d/autojump.sh autoload -U compinit && compinit -u
|
||||
188
dotfiles/Microsoft.PowerShell_profile.ps1
Normal file
188
dotfiles/Microsoft.PowerShell_profile.ps1
Normal file
@@ -0,0 +1,188 @@
|
||||
#
|
||||
$canConnectToGitHub = Test-Connection github.com -Count 1 -Quiet -TimeoutSeconds 1
|
||||
|
||||
function Install-CustomModules {
|
||||
param (
|
||||
[string]$ModuleName = ''
|
||||
)
|
||||
# check if module is installed
|
||||
$moduleInfo = Get-Module -ListAvailable -Name $ModuleName -ErrorAction SilentlyContinue
|
||||
if ($moduleInfo) { return }
|
||||
|
||||
Write-Host "${ModuleName} module not found." -ForegroundColor Red
|
||||
Install-Module -Name $ModuleName -Scope CurrentUser
|
||||
|
||||
Import-Module -Name $ModuleName
|
||||
}
|
||||
|
||||
Install-CustomModules -ModuleName 'tiPS'
|
||||
Install-CustomModules -ModuleName 'PSScriptAnalyzer'
|
||||
Install-CustomModules -ModuleName 'Terminal-Icons'
|
||||
Install-CustomModules -ModuleName 'PSReadLine'
|
||||
Install-CustomModules -ModuleName 'PSWindowsUpdate'
|
||||
|
||||
# kali.omp.json
|
||||
oh-my-posh --init --shell pwsh --config "$env:OneDrive\Documents\PowerShell\prompt\themes\stelbent-compact.minimal.omp.json" | Invoke-Expression
|
||||
|
||||
Set-PSReadLineOption -PredictionSource History
|
||||
Set-PSReadLineOption -PredictionViewStyle ListView
|
||||
Set-PSReadLineOption -EditMode Windows
|
||||
Set-PSReadLineKeyHandler -Key Tab -Function Complete
|
||||
|
||||
Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
|
||||
param($wordToComplete, $commandAst, $cursorPosition)
|
||||
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
|
||||
$Local:word = $wordToComplete.Replace('"', '""')
|
||||
$Local:ast = $commandAst.ToString().Replace('"', '""')
|
||||
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
|
||||
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
||||
}
|
||||
}
|
||||
function Get-Ip-Address {
|
||||
(Invoke-WebRequest -Uri ifconfig.me/ip).Content
|
||||
}
|
||||
|
||||
Set-Alias getIp Get-Ip-Address
|
||||
|
||||
function Invoke-WslReboot() {
|
||||
param (
|
||||
[string]$Distro = 'Debian'
|
||||
)
|
||||
Write-Host "Rebooting $Distro"
|
||||
wsl --shutdown
|
||||
}
|
||||
|
||||
Set-Alias wslreboot Invoke-WslReboot
|
||||
|
||||
function Update-Budget() {
|
||||
Write-Host "Updating budget database"
|
||||
py D:\dev\export-budget-csv\export.py -s "$env:OneDrive\Documents\Financial\Wood Family Financials.xlsx"
|
||||
Write-Host "Budget database updated"
|
||||
}
|
||||
|
||||
Set-Alias updbudget Update-Budget
|
||||
|
||||
function Update-Winget() {
|
||||
winget upgrade
|
||||
}
|
||||
|
||||
Set-Alias wgu Update-Winget
|
||||
#f45873b3-b655-43a6-b217-97c00aa0db58 PowerToys CommandNotFound module
|
||||
|
||||
Import-Module -Name Microsoft.WinGet.CommandNotFound
|
||||
#f45873b3-b655-43a6-b217-97c00aa0db58
|
||||
|
||||
if (Get-Command zoxide -ErrorAction SilentlyContinue) {
|
||||
Invoke-Expression (& { (zoxide init powershell | Out-String) })
|
||||
}
|
||||
else {
|
||||
Write-Host "zoxide command not found. Attempting to install via winget..."
|
||||
try {
|
||||
winget install -e --id ajeetdsouza.zoxide
|
||||
Write-Host "zoxide installed successfully. Initializing..."
|
||||
Invoke-Expression (& { (zoxide init powershell | Out-String) })
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to install zoxide. Error: $_"
|
||||
}
|
||||
}
|
||||
|
||||
Set-TiPSConfiguration -AutomaticallyWritePowerShellTip EverySession
|
||||
|
||||
# Finds files recursively matching a pattern.
|
||||
function ff($name) {
|
||||
Get-ChildItem -Recurse -Filter "*${name}*" -ErrorAction SilentlyContinue | ForEach-Object { Write-Output "${$_.directory}\$(%_)" }
|
||||
}
|
||||
|
||||
# Creates an empty file (similar to the touch command in Linux).
|
||||
function touch($file) {
|
||||
"" | Out-File -File $file -Encoding ascii
|
||||
}
|
||||
|
||||
# Reloads the current profile.
|
||||
function Update-Profile {
|
||||
& $PROFILE
|
||||
}
|
||||
|
||||
# Checks for and updates PowerShell to the latest version.
|
||||
function Update-PowerShell {
|
||||
if (-not $global:canConnectToGitHub) {
|
||||
Write-Host "Skipping PowerShell update check due to GitHub.com not responding within 1 second." -ForegroundColor Yellow
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Host "Checking for PowerShell updates..." -ForegroundColor Cyan
|
||||
$updateNeeded = $false
|
||||
$currentVersion = $PSVersionTable.PSVersion.ToString()
|
||||
$gitHubApiUrl = "https://api.github.com/repos/PowerShell/PowerShell/releases/latest"
|
||||
$latestReleaseInfo = Invoke-RestMethod -Uri $gitHubApiUrl
|
||||
$latestVersion = $latestReleaseInfo.tag_name.Trim('v')
|
||||
if ($currentVersion -lt $latestVersion) {
|
||||
$updateNeeded = $true
|
||||
}
|
||||
|
||||
if ($updateNeeded) {
|
||||
Write-Host "Updating PowerShell..." -ForegroundColor Yellow
|
||||
winget upgrade "Microsoft.PowerShell" --accept-source-agreements --accept-package-agreements
|
||||
Write-Host "PowerShell has been updated. Please restart your shell to reflect changes" -ForegroundColor Magenta
|
||||
}
|
||||
else {
|
||||
Write-Host "Your PowerShell is up to date." -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to update PowerShell. Error: $_"
|
||||
}
|
||||
}
|
||||
Update-PowerShell
|
||||
|
||||
# Searches for a regular expression in files (similar to the grep command in Linux).
|
||||
function grep($regex, $dir) {
|
||||
if ( $dir ) {
|
||||
Get-ChildItem $dir | select-string $regex
|
||||
return
|
||||
}
|
||||
$input | select-string $regex
|
||||
}
|
||||
|
||||
# Displays disk volume information.
|
||||
function df {
|
||||
get-volume
|
||||
}
|
||||
|
||||
# Displays the first n lines of a file8587
|
||||
function head {
|
||||
param($Path, $n = 10)
|
||||
Get-Content $Path -Head $n
|
||||
}
|
||||
|
||||
# Displays the last n lines of a file
|
||||
function tail {
|
||||
param($Path, $n = 10)
|
||||
Get-Content $Path -Tail $n
|
||||
}
|
||||
|
||||
# Navigates to the Documents directory.
|
||||
function docs { Set-Location -Path $HOME\Documents }
|
||||
|
||||
# Navigates to the Downloads directory.
|
||||
function dl { Set-Location -Path $HOME\Downloads }
|
||||
|
||||
# Clears the DNS client cache.
|
||||
function flushdns { Clear-DnsClientCache }
|
||||
|
||||
# Copies text to the clipboard.
|
||||
function cpy { Set-Clipboard $args[0] }
|
||||
|
||||
# Gets the text from the clipboard.
|
||||
function pst { Get-Clipboard }
|
||||
|
||||
# Enhanced PowerShell Experience
|
||||
Set-PSReadLineOption -Colors @{
|
||||
Command = 'Yellow'
|
||||
Parameter = 'Green'
|
||||
String = 'DarkCyan'
|
||||
}
|
||||
|
||||
# http://bin.christitus.com/unakijolon
|
||||
188
dotfiles/Microsoft.VSCode_profile.ps1
Normal file
188
dotfiles/Microsoft.VSCode_profile.ps1
Normal file
@@ -0,0 +1,188 @@
|
||||
#
|
||||
$canConnectToGitHub = Test-Connection github.com -Count 1 -Quiet -TimeoutSeconds 1
|
||||
|
||||
function Install-CustomModules {
|
||||
param (
|
||||
[string]$ModuleName = ''
|
||||
)
|
||||
# check if module is installed
|
||||
$moduleInfo = Get-Module -ListAvailable -Name $ModuleName -ErrorAction SilentlyContinue
|
||||
if ($moduleInfo) { return }
|
||||
|
||||
Write-Host "${ModuleName} module not found." -ForegroundColor Red
|
||||
Install-Module -Name $ModuleName -Scope CurrentUser
|
||||
|
||||
Import-Module -Name $ModuleName
|
||||
}
|
||||
|
||||
Install-CustomModules -ModuleName 'tiPS'
|
||||
Install-CustomModules -ModuleName 'PSScriptAnalyzer'
|
||||
Install-CustomModules -ModuleName 'Terminal-Icons'
|
||||
Install-CustomModules -ModuleName 'PSReadLine'
|
||||
Install-CustomModules -ModuleName 'PSWindowsUpdate'
|
||||
|
||||
# kali.omp.json
|
||||
oh-my-posh --init --shell pwsh --config "$env:OneDrive\Documents\PowerShell\prompt\themes\stelbent-compact.minimal.omp.json" | Invoke-Expression
|
||||
|
||||
Set-PSReadLineOption -PredictionSource History
|
||||
Set-PSReadLineOption -PredictionViewStyle ListView
|
||||
Set-PSReadLineOption -EditMode Windows
|
||||
Set-PSReadLineKeyHandler -Key Tab -Function Complete
|
||||
|
||||
Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
|
||||
param($wordToComplete, $commandAst, $cursorPosition)
|
||||
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
|
||||
$Local:word = $wordToComplete.Replace('"', '""')
|
||||
$Local:ast = $commandAst.ToString().Replace('"', '""')
|
||||
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
|
||||
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
||||
}
|
||||
}
|
||||
function Get-Ip-Address {
|
||||
(Invoke-WebRequest -Uri ifconfig.me/ip).Content
|
||||
}
|
||||
|
||||
Set-Alias getIp Get-Ip-Address
|
||||
|
||||
function Invoke-WslReboot() {
|
||||
param (
|
||||
[string]$Distro = 'Debian'
|
||||
)
|
||||
Write-Host "Rebooting $Distro"
|
||||
wsl --shutdown
|
||||
}
|
||||
|
||||
Set-Alias wslreboot Invoke-WslReboot
|
||||
|
||||
function Update-Budget() {
|
||||
Write-Host "Updating budget database"
|
||||
py D:\dev\export-budget-csv\export.py -s "$env:OneDrive\Documents\Financial\Wood Family Financials.xlsx"
|
||||
Write-Host "Budget database updated"
|
||||
}
|
||||
|
||||
Set-Alias updbudget Update-Budget
|
||||
|
||||
function Update-Winget() {
|
||||
winget upgrade
|
||||
}
|
||||
|
||||
Set-Alias wgu Update-Winget
|
||||
#f45873b3-b655-43a6-b217-97c00aa0db58 PowerToys CommandNotFound module
|
||||
|
||||
Import-Module -Name Microsoft.WinGet.CommandNotFound
|
||||
#f45873b3-b655-43a6-b217-97c00aa0db58
|
||||
|
||||
if (Get-Command zoxide -ErrorAction SilentlyContinue) {
|
||||
Invoke-Expression (& { (zoxide init powershell | Out-String) })
|
||||
}
|
||||
else {
|
||||
Write-Host "zoxide command not found. Attempting to install via winget..."
|
||||
try {
|
||||
winget install -e --id ajeetdsouza.zoxide
|
||||
Write-Host "zoxide installed successfully. Initializing..."
|
||||
Invoke-Expression (& { (zoxide init powershell | Out-String) })
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to install zoxide. Error: $_"
|
||||
}
|
||||
}
|
||||
|
||||
Set-TiPSConfiguration -AutomaticallyWritePowerShellTip EverySession
|
||||
|
||||
# Finds files recursively matching a pattern.
|
||||
function ff($name) {
|
||||
Get-ChildItem -Recurse -Filter "*${name}*" -ErrorAction SilentlyContinue | ForEach-Object { Write-Output "${$_.directory}\$(%_)" }
|
||||
}
|
||||
|
||||
# Creates an empty file (similar to the touch command in Linux).
|
||||
function touch($file) {
|
||||
"" | Out-File -File $file -Encoding ascii
|
||||
}
|
||||
|
||||
# Reloads the current profile.
|
||||
function Update-Profile {
|
||||
& $PROFILE
|
||||
}
|
||||
|
||||
# Checks for and updates PowerShell to the latest version.
|
||||
function Update-PowerShell {
|
||||
if (-not $global:canConnectToGitHub) {
|
||||
Write-Host "Skipping PowerShell update check due to GitHub.com not responding within 1 second." -ForegroundColor Yellow
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Host "Checking for PowerShell updates..." -ForegroundColor Cyan
|
||||
$updateNeeded = $false
|
||||
$currentVersion = $PSVersionTable.PSVersion.ToString()
|
||||
$gitHubApiUrl = "https://api.github.com/repos/PowerShell/PowerShell/releases/latest"
|
||||
$latestReleaseInfo = Invoke-RestMethod -Uri $gitHubApiUrl
|
||||
$latestVersion = $latestReleaseInfo.tag_name.Trim('v')
|
||||
if ($currentVersion -lt $latestVersion) {
|
||||
$updateNeeded = $true
|
||||
}
|
||||
|
||||
if ($updateNeeded) {
|
||||
Write-Host "Updating PowerShell..." -ForegroundColor Yellow
|
||||
winget upgrade "Microsoft.PowerShell" --accept-source-agreements --accept-package-agreements
|
||||
Write-Host "PowerShell has been updated. Please restart your shell to reflect changes" -ForegroundColor Magenta
|
||||
}
|
||||
else {
|
||||
Write-Host "Your PowerShell is up to date." -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to update PowerShell. Error: $_"
|
||||
}
|
||||
}
|
||||
Update-PowerShell
|
||||
|
||||
# Searches for a regular expression in files (similar to the grep command in Linux).
|
||||
function grep($regex, $dir) {
|
||||
if ( $dir ) {
|
||||
Get-ChildItem $dir | select-string $regex
|
||||
return
|
||||
}
|
||||
$input | select-string $regex
|
||||
}
|
||||
|
||||
# Displays disk volume information.
|
||||
function df {
|
||||
get-volume
|
||||
}
|
||||
|
||||
# Displays the first n lines of a file8587
|
||||
function head {
|
||||
param($Path, $n = 10)
|
||||
Get-Content $Path -Head $n
|
||||
}
|
||||
|
||||
# Displays the last n lines of a file
|
||||
function tail {
|
||||
param($Path, $n = 10)
|
||||
Get-Content $Path -Tail $n
|
||||
}
|
||||
|
||||
# Navigates to the Documents directory.
|
||||
function docs { Set-Location -Path $HOME\Documents }
|
||||
|
||||
# Navigates to the Downloads directory.
|
||||
function dl { Set-Location -Path $HOME\Downloads }
|
||||
|
||||
# Clears the DNS client cache.
|
||||
function flushdns { Clear-DnsClientCache }
|
||||
|
||||
# Copies text to the clipboard.
|
||||
function cpy { Set-Clipboard $args[0] }
|
||||
|
||||
# Gets the text from the clipboard.
|
||||
function pst { Get-Clipboard }
|
||||
|
||||
# Enhanced PowerShell Experience
|
||||
Set-PSReadLineOption -Colors @{
|
||||
Command = 'Yellow'
|
||||
Parameter = 'Green'
|
||||
String = 'DarkCyan'
|
||||
}
|
||||
|
||||
# http://bin.christitus.com/unakijolon
|
||||
120
dotfiles/README.md
Normal file
120
dotfiles/README.md
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
# dotfiles
|
||||
|
||||
My personal dotfiles and system setup configuration for Linux machines.
|
||||
|
||||
## Quick Start
|
||||
|
||||
To set up a new machine, run:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://raw.githubusercontent.com/acedanger/shell/main/bootstrap.sh | bash
|
||||
```
|
||||
|
||||
## What's Included
|
||||
|
||||
### Package Managers
|
||||
- [**Nala**](https://gitlab.com/volian/nala): A better front-end for `apt` with parallel downloads and improved interface
|
||||
- [**VS Code**](https://code.visualstudio.com/): Microsoft's popular code editor
|
||||
- [**GitHub CLI**](https://cli.github.com/): Official GitHub command-line tool
|
||||
|
||||
### Core Packages
|
||||
- [`git`](https://git-scm.com/): Version control
|
||||
- [`python3`](https://www.python.org/): Python runtime
|
||||
- [`wget`](https://www.gnu.org/software/wget/) & [`curl`](https://curl.se/): Download utilities
|
||||
- [`bat`](https://github.com/sharkdp/bat): A better `cat` with syntax highlighting
|
||||
- [`cowsay`](https://github.com/piuccio/cowsay): For fun CLI messages
|
||||
- [`lolcat`](https://github.com/busyloop/lolcat): Colorful terminal output
|
||||
- [`fzf`](https://github.com/junegunn/fzf): Fuzzy finder
|
||||
- [`zsh`](https://www.zsh.org/): Better shell
|
||||
- [`nala`](https://gitlab.com/volian/nala): Better package manager for Debian/Ubuntu
|
||||
|
||||
### Shell Setup
|
||||
- [**Oh My Zsh**](https://ohmyz.sh/): Framework for managing Zsh configuration
|
||||
- [**Agnoster Theme**](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster): Beautiful terminal theme with Git integration
|
||||
|
||||
#### Zsh Plugins
|
||||
1. [`zsh-autosuggestions`](https://github.com/zsh-users/zsh-autosuggestions): Suggests commands as you type based on history
|
||||
2. [`zsh-syntax-highlighting`](https://github.com/zsh-users/zsh-syntax-highlighting): Syntax highlighting for the shell
|
||||
3. [`zsh-you-should-use`](https://github.com/MichaelAquilina/zsh-you-should-use): Reminds you of existing aliases
|
||||
4. [`git`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git): Git integration and aliases
|
||||
5. [`docker`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker): Docker commands integration
|
||||
6. [`docker-compose`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker-compose): Docker Compose integration
|
||||
7. [`z`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/z): Quick directory jumping
|
||||
8. [`ssh`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/ssh): SSH configuration and shortcuts
|
||||
|
||||
### Development Tools
|
||||
- [**nvm**](https://github.com/nvm-sh/nvm): Node Version Manager for managing Node.js versions
|
||||
- [**zoxide**](https://github.com/ajeetdsouza/zoxide): Smarter directory navigation (a modern replacement for `z`)
|
||||
- [**Lazydocker**](https://github.com/jesseduffield/lazydocker): Terminal UI for Docker and Docker Compose, making container management easier
|
||||
- [**VS Code**](https://code.visualstudio.com/): Code editor with essential extensions
|
||||
|
||||
## Features
|
||||
|
||||
### Automatic Setup
|
||||
- Automatically installs and configures all necessary packages and tools
|
||||
- Sets up Zsh as the default shell
|
||||
- Configures Nala package manager with optimized mirrors
|
||||
- Installs and configures Node.js LTS version via nvm
|
||||
- Installs Lazydocker for Docker container management
|
||||
- Sets up VS Code with recommended extensions
|
||||
|
||||
### Dotfile Management
|
||||
- Automatically symlinks all configuration files
|
||||
- Manages Zsh configuration and plugins
|
||||
- Sets up Git configuration
|
||||
- Configures custom aliases and functions
|
||||
|
||||
### Custom Configurations
|
||||
- Terminal greeting with fortune and cowsay
|
||||
- Optimized Zsh history settings
|
||||
- Improved command-line navigation with zoxide
|
||||
- Automatic Node.js version switching using .nvmrc
|
||||
|
||||
## Installation Process
|
||||
|
||||
1. The script will first set up necessary package repositories:
|
||||
- Nala package manager
|
||||
- VS Code
|
||||
- GitHub CLI
|
||||
|
||||
2. Install core packages using Nala for better performance
|
||||
|
||||
3. Install special tools not available via apt:
|
||||
- Lazydocker (Docker TUI manager)
|
||||
|
||||
4. Set up the shell environment:
|
||||
- Install Zsh and Oh My Zsh
|
||||
- Configure Zsh plugins and themes
|
||||
- Set up custom aliases and configurations
|
||||
|
||||
5. Install development tools:
|
||||
- Set up nvm and Node.js
|
||||
- Configure zoxide for better navigation
|
||||
- Install and configure Git
|
||||
|
||||
## Manual Steps
|
||||
|
||||
If you need to manually set up aliases:
|
||||
|
||||
```sh
|
||||
# Create new symlink
|
||||
ln -s ~/shell/dotfiles/my-aliases.zsh ~/.oh-my-zsh/custom/aliases.zsh
|
||||
|
||||
# If the symlink already exists, use -f to force creation
|
||||
ln -sf ~/shell/dotfiles/my-aliases.zsh ~/.oh-my-zsh/custom/aliases.zsh
|
||||
```
|
||||
|
||||
## Post-Installation
|
||||
|
||||
After installation:
|
||||
1. Start a new terminal session or run `zsh`
|
||||
2. The shell will be configured with all plugins and settings
|
||||
3. You can start using all installed tools and aliases
|
||||
|
||||
## Maintenance
|
||||
|
||||
To update your setup:
|
||||
1. Pull the latest changes from the repository
|
||||
2. Run the setup script again - it's designed to be idempotent
|
||||
3. Start a new shell session to apply any changes
|
||||
14
dotfiles/my-aliases.zsh
Normal file
14
dotfiles/my-aliases.zsh
Normal file
@@ -0,0 +1,14 @@
|
||||
alias py=python3
|
||||
alias gp="git pull"
|
||||
alias gpush="git push"
|
||||
alias gc="git commit"
|
||||
alias gcm="git commit -m"
|
||||
|
||||
alias ll="ls -laFh --group-directories-first --color=auto"
|
||||
alias findzombie="ps -A -ostat,pid,ppid | grep -e '[zZ]'"
|
||||
alias plex="/home/acedanger/shell/plex.sh"
|
||||
alias update="/home/acedanger/shell/update.sh"
|
||||
alias dcdn="docker compose down"
|
||||
alias dcupd="docker compose up -d"
|
||||
alias lzd="lazydocker"
|
||||
alias cat="batcat"
|
||||
59
dotfiles/tailscale-acl.json
Normal file
59
dotfiles/tailscale-acl.json
Normal file
@@ -0,0 +1,59 @@
|
||||
// Example/default ACLs for unrestricted connections.
|
||||
{
|
||||
// Define access control lists for users, groups, autogroups, tags,
|
||||
// Tailscale IP addresses, and subnet ranges.
|
||||
"acls": [
|
||||
{
|
||||
"action": "accept",
|
||||
"src": ["tag:client", "tag:server", "acedanger49@gmail.com"],
|
||||
"dst": ["tag:golink:*", "tag:server:*"],
|
||||
},
|
||||
// Allow all connections.
|
||||
// Comment this section out if you want to define specific restrictions.
|
||||
{"action": "accept", "src": ["*"], "dst": ["*:*"]},
|
||||
],
|
||||
|
||||
// Define users and devices that can use Tailscale SSH.
|
||||
"ssh": [
|
||||
{
|
||||
// any user can use Tailscale SSH to connect to their own devices
|
||||
// in check mode as a root or non-root user
|
||||
"action": "accept",
|
||||
"src": ["tag:client", "tag:server", "acedanger49@gmail.com"],
|
||||
"dst": ["tag:server"],
|
||||
"users": ["autogroup:nonroot", "root"],
|
||||
},
|
||||
{
|
||||
// any user can use Tailscale SSH to connect to their own devices
|
||||
// in check mode as a root or non-root user
|
||||
"action": "check",
|
||||
"src": ["autogroup:member"],
|
||||
"dst": ["autogroup:self"],
|
||||
"users": ["autogroup:nonroot", "root"],
|
||||
},
|
||||
],
|
||||
|
||||
"nodeAttrs": [
|
||||
{
|
||||
// Funnel policy, which lets tailnet members control Funnel
|
||||
// for their own devices.
|
||||
// Learn more at https://tailscale.com/kb/1223/tailscale-funnel/
|
||||
"target": ["autogroup:member"],
|
||||
"attr": ["funnel"],
|
||||
},
|
||||
{"target": ["*"], "app": {"tailscale.com/app-connectors": []}},
|
||||
],
|
||||
|
||||
// Define the tags which can be applied to devices and by which users.
|
||||
"tagOwners": {
|
||||
"tag:golink": ["acedanger49@gmail.com"],
|
||||
"tag:server": ["acedanger49@gmail.com"],
|
||||
"tag:client": ["acedanger49@gmail.com"],
|
||||
"tag:docker": ["acedanger49@gmail.com"],
|
||||
},
|
||||
|
||||
"autoapprovers": {
|
||||
"exitNode": ["autogroup:admin"],
|
||||
},
|
||||
// Test access rules every time they're saved.
|
||||
}
|
||||
Reference in New Issue
Block a user