Skip to content

Instantly share code, notes, and snippets.

@hasparus
Last active May 26, 2022 17:13
Show Gist options
  • Save hasparus/694e73b053d7ec1ca8dbda0124a79114 to your computer and use it in GitHub Desktop.
Save hasparus/694e73b053d7ec1ca8dbda0124a79114 to your computer and use it in GitHub Desktop.
A guide on setting up on new laptops for future me, and a manifest of all the tools I installed.
# Git Completions
Import-Module posh-git
# Prompt
Invoke-Expression (&starship init powershell)
# Aliases
Set-Alias g git
# Utils
function wk {
# Goes to a project inside d:/workspace with autocompletion
[CmdletBinding()]
param ()
dynamicParam {
# create a dictionary to return, and collection of parameters
$paramDictionary = New-Object -Type System.Management.Automation.RuntimeDefinedParameterDictionary
$attributeCollection = New-Object -Type System.Collections.ObjectModel.Collection[System.Attribute]
# create a new [string] parameter for all parameter sets, and decorate with a [ValidateSet]
$dynParam = New-Object -Type System.Management.Automation.RuntimeDefinedParameter("Directory", [String], $attributeCollection)
$attributes = New-Object System.Management.Automation.ParameterAttribute
$attributes.Position = 0
$paramOptions = New-Object System.Management.Automation.ValidateSetAttribute -ArgumentList (Get-ChildItem "d:/workspace" -Name)
# hook things together
$attributeCollection.Add($attributes)
$attributeCollection.Add($paramOptions)
$paramDictionary.Add("Directory", $dynParam)
return $paramDictionary
}
process {
Set-StrictMode -Version Latest
if ($PSBoundParameters.Keys.Contains("Directory")) {
$Directory = $PSBoundParameters.Directory
cd "d:/workspace/$Directory"
} else {
cd "d:/workspace"
}
}
}
function y {
# Reads "scripts" in package.json and autocompletes them for better developer experience
[CmdletBinding()]
param()
dynamicParam {
$paramDictionary = New-Object -Type System.Management.Automation.RuntimeDefinedParameterDictionary
$attributeCollection = New-Object -Type System.Collections.ObjectModel.Collection[System.Attribute]
$dynParam = New-Object -Type System.Management.Automation.RuntimeDefinedParameter("ScriptName", [String], $attributeCollection)
$attributes = New-Object System.Management.Automation.ParameterAttribute
$attributes.Position = 0
$attributes.Mandatory = $true
if (Test-Path "./package.json") {
$pkg = Get-Content .\package.json | ConvertFrom-Json
$scripts = $pkg.scripts | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name
$paramOptions = New-Object System.Management.Automation.ValidateSetAttribute -ArgumentList $scripts
$attributeCollection.Add($paramOptions)
}
$attributeCollection.Add($attributes)
$paramDictionary.Add("ScriptName", $dynParam)
return $paramDictionary
}
process {
Set-StrictMode -Version Latest
yarn $PSBoundParameters.ScriptName
}
}
function todos {
code "$(Resolve-Path ~)/todo.txt"
}
function rmrf {
param(
[parameter(Position=0)][string]$directory
)
process {
# rm -r -fo $directory
Remove-Item -Recurse -Force $directory
}
}

Hey Pete from the future! I hope you won't have to suffer through installing everything one-by-one like I'm doing right now.

System-agnostic

Essentials

  • Browser, I'm using Brave currently
  • Copy .gitconfig with all aliases you're using
  • Sync your VSCode User Settings

Additional

  • Discord with installer -- Discord needs to always be on the latest version so package managers failed me here in the past
  • Text expander espanso with installer from the website

Linux

  • VSCode from package manager or app store
  • Git from package manager if it isn't preinstalled
  • Copy your .bashrc

Windows

Use scoop or try to learn if winget is already stable and mature.

Here's the list of packages installed as of 26 May 2022 and a command to install them.
❯ scoop list
Installed apps:

Name       Version          Source     Updated             Info
----       -------          ------     -------             ----
7zip       19.00            main       2021-06-03 11:03:53
act        0.2.24           main       2021-10-02 09:40:28
curl       7.77.0_2         main       2021-06-03 11:04:37
firacode   5.2              nerd-fonts 2021-06-04 23:09:29
fnm        1.28.2           main       2021-12-10 13:45:57
gh         2.8.0            main       2022-04-14 15:44:15
gimp       2.10.20-1        extras     2021-07-05 19:12:52
git        2.31.1.windows.1 main       2021-06-03 11:23:24
grep       2.5.4            main       2021-06-15 12:24:06
innounp    0.50             main       2021-06-05 09:08:42
iosevka-nf 2.1.0            nerd-fonts 2021-06-04 23:10:12
libwebp    1.2.2            main       2022-05-26 19:07:05
mkcert     1.4.3            extras     2021-07-02 12:19:22
nodejs     17.2.0           main       2021-12-10 13:02:11
rustup     1.24.3           main       2021-06-15 22:34:39
sed        4.2.1            main       2021-07-07 14:26:33
starship   0.54.0           main       2021-06-04 23:01:22
sudo       0.2020.01.26     main       2021-06-03 11:25:08
touch      0.2018.07.25     main       2021-06-04 23:02:30
scoop install touch git nodejs-lts innoup rust libwebp

scoop bucket add nerd-fonts
scoop install iosevka-nf firacode
  • VSCode with installer from the official website.
  • Copy your PowerShell $PROFILE.
  • Install Posh-Git.
  • Install Docker Desktop. (Had issues with docker from scoop previously.)
  • Install Visual Studio Build Tools -- It's needed for node-gyp.

Directory structure

D:/
  workspace
    project-1
    project-2
    ...
  tools
    VSCode
    ...

Diary

  • 05 June 2021 - Bought new Windows laptop. Migrating from Pop_OS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment