Featuring:
- mkgit - mkdir on steroids
- git-alias - my essential git aliases
- getignore - download the right .gitignore
- open - simple aliases
Also starring:
- Gets duplicate directories in two paths
- Normalizes BenchmarkDotNet csv output
- Delete directories that match pattern
- Watch for file changes and copy updated files
- Enable and disable Fusion Log
mkdir on steroids: Creates a directory, and within it: initializes git repo, creates src\ and readme.md, downloads a .gitignore file for the specified language from GitHub's gitignore repository
mkgit myproject Rust
Brings my favorite git aliases
Comes in handy on a freshly installed OS
The ones I use a lot:
git st
shows status in a minimal formatgit put "commit message"
commits all unstaged files in single commandgit last
shows details of the last commitgit diffs
shows diff of staged changes -diff --cached
git diffl
shows diff of the commit -diff HEAD HEAD~
git d
shows diff of the working tree, followed by minimal statusgit ls
shows a concise and abundant loggit please
ispush --force-with-lease
Downloads a .gitignore file for the specified language from GitHub's gitignore repository and renames it to .gitignore
Note: Online repository uses PascalCase to specify the gitignore file.
getignore Node
on Windows, use the Linux subsystem
bash getignore VisualStudio
Use shortcuts to access files
Param -a records the alias
> open -a dl C:\users\ama\Downloads
> open -a utilities /mnt/c/src/utilities
> open -a dosbox %localappdata%\DOSBox\dosbox-0.74.conf
Param -r prints alias' target
> open -r utilities
/mnt/c/src/utilities
Param -l lists aliases
Without parameters, the alias is executed
> open dosbox
(text editor opens the file)
> open dl
(explorer opens the directory)
Finds subdirectories in the two trees that contain files with the same name. Useful to find duplicates when merging music collections.
getDuplicateDirs /path/one /path/two
Normalizes magnitude of values in specified column of a CSV file, removes unit and places it in the column header.
BenchmarkDotNet 0.10.1 produces .csv files that can't be easily analyzed in software
Sample:
python .\normalize-csv.py "D:\sample.csv" Mean
Turns
...,Mean,...
...,0.987 s,...
...,"1,234 ms",...
....512.32 ms,...
into
...,Mean [ms],...
...,987,...
...,1234,...
....512.32,...
Deletes (after receiving confirmation) all directories inside path
that contain any of the elements of the pattern
Sample:
#load delete-directories.csx
DeleteDirectories("H:\\Premiere", new List<string>
{
"Adobe Premiere Pro Auto-Save",
"Adobe Premiere Pro Preview Files"
});
Watches for file changes and copies modified files.
Optionally executes a custom Action
afterwards.
I use it to copy build output to a remote share, and again from there to a remote desktop. After copying to a remote desktop, I start a Process
that does extra work
Sample:
#load file-automation.csx
var hostPattern = new List<CopyOrder>
{
new CopyOrder(@"C:\file1.txt", @"\\share\file1.txt"),
new CopyOrder(@"C:\file2.txt", @"\\share\file2.txt"),
};
FileProcessor.Start(hostPattern);
#load file-automation.csx
var clientPattern = new List<CopyOrder>
{
new CopyOrder(@"\\share\file1.txt", @"D:\file1.txt", () => { /* file1 custom action */ }),
new CopyOrder(@"\\share\file2.txt", @"D:\file2.txt", () => { /* file2 custom action */ }),
};
FileProcessor.Start(clientPattern);
To force-copy files when the script starts, use FileProcessor.Start(pattern, force: true);
Enables or disables the Fusion Log capabilities.
Stores logs in %temp%\FusionLog
Fusion Log is heavy on resources, so I keep it enabled only when I need it.
Sample: Run VS developer command prompt as administrator
To toggle Fusion Log:
csi "D:\Utilities\scripts\fusion-log.csx"
To explicitly enable Fusion Log:
csi "D:\Utilities\scripts\fusion-log.csx" 1
To explicitly disable Fusion Log:
csi "D:\Utilities\scripts\fusion-log.csx" 0