Skip to content

hsyps/custom-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

custom-scripts

A collection of personal terminal scripts, aliases, and configurations for macOS, Ubuntu (WSL), Windows Command Prompt, and PowerShell.

Table of Contents


Features

All Platforms

  • Git Aliases: Standard shortcuts (ga, gc, gb, gcm, gpo, etc.) to speed up development.
  • Login Templates: Helper functions for testing request-based authentication tools (e.g., Teleport tsh).
  • Proxy Toggles: Easily toggle network proxies on and off (available in Unix-based setups).

Testing Without Installing

Want to try the scripts out without modifying your system profiles?

  • macOS & Ubuntu: Run source macos/.zshrc or source ubuntu/.zshrc in your current terminal. The changes only last until you close the window.
  • Windows (Command Prompt): Run windows\aliases.bat in your current CMD window.
  • Windows (PowerShell): Run . .\windows\profile.ps1 in your current PowerShell window.

You can also safely run the installers in Dry Run mode to see what files would be modified without actually changing anything:

  • Bash: ./install.sh --dry-run
  • PowerShell: .\install.ps1 -DryRun

Installation

Automated Installation (Recommended)

  1. Clone the repository to a permanent location on your machine.
  2. Run the install script for your platform:

macOS & Ubuntu (WSL)

cd custom-scripts
chmod +x install.sh
./install.sh

Windows (Command Prompt & PowerShell) Open PowerShell (as Administrator for best results) and run:

cd custom-scripts
.\install.ps1

Manual Installation

If you prefer to install manually, you can copy the respective configuration files to your system:

  • macOS: cp macos/.zshrc ~/.zshrc
  • Ubuntu: cp ubuntu/.zshrc ~/.zshrc
  • Windows (CMD): Add a registry key in HKCU\Software\Microsoft\Command Processor for AutoRun pointing to windows\aliases.bat.
  • Windows (PS): Add . "C:\Path\To\custom-scripts\windows\profile.ps1" to your $PROFILE.

(Note: On Ubuntu, ensure zsh is installed sudo apt install zsh and set as the default shell chsh -s $(which zsh)).


Usage

Git

Standard aliases available across all platforms:

  • ga -> git add
  • gcm "msg" -> git commit -m "msg"
  • gb -> git branch
  • gpo -> git push origin
  • gpl -> git pull

Smart Fallbacks (PowerShell only) Because PowerShell has built-in aliases that conflict with common Git shortcuts, the Windows PowerShell profile includes "smart fallback" logic:

  • gcm: If you pass a valid PowerShell command (e.g., gcm ls), it acts as Get-Command. Otherwise, it acts as git commit -m and automatically stitches your words together so you don't need quotes (e.g., gcm added new feature).
  • gc: If you pass an existing file path (e.g., gc README.md), it safely acts as Get-Content to read the file. Otherwise, it acts as git checkout. (Note: To discard changes on an existing file, you must type out the full git checkout filename to prevent accidental data loss).

Login & Connect Templates

# Example usage for logging into Teleport with a Request ID
tshLogin <request-id>

Proxies (macOS/Ubuntu only)

# Enable Proxy
use-proxy

# Disable Proxy
no-proxy

# Status
proxy_status  # (Returns 🟢 or 🔴)

Scripts Reference

custom-scripts/windows/aliases.bat

Batch file for Windows Command Prompt.

  • Contains standard aliases, login template, and helper functions.

custom-scripts/windows/profile.ps1

PowerShell profile script.

  • Contains standard functions, aliases, and login template formatted for PowerShell.

custom-scripts/macos/.zshrc

macOS zsh configuration.

  • Standard aliases, proxy toggles, and login templates.

custom-scripts/ubuntu/.zshrc

Ubuntu (WSL) zsh configuration.

  • Standard aliases, proxy toggles, and login templates.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Happy coding! ~Hasimy

About

Custom scripts for your Terminal (macOS, Ubuntu), Command Prompt, and Windows Powershell.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors