Skip to content

Instantly share code, notes, and snippets.

View varunswarup0's full-sized avatar
💻
building...

Varun Swarup varunswarup0

💻
building...
View GitHub Profile
@markwragg
markwragg / profile.ps1
Created March 5, 2020 09:30
PowerShell Profile snippet to save/return to last location on exit
$LastLocationFile = Join-Path $env:USERPROFILE 'lastlocation.txt'
If (Test-Path $LastLocationFile) {
Import-Clixml $LastLocationFile | Set-Location
}
Else {
Set-Location $env:USERPROFILE
}
Register-EngineEvent PowerShell.Exiting -Action {

How to get @DevBlackOps Terminal-Icons module working in PowerShell on Windows

Note: since version 0.1.1 of the module this now works in Windows PowerShell or PowerShell Core.

  1. Download and install this version of Literation Mono Nerd Font which has been specifically fixed to be recognised as monospace on Windows:

https://github.com/haasosaurus/nerd-fonts/blob/regen-mono-font-fix/patched-fonts/LiberationMono/complete/Literation%20Mono%20Nerd%20Font%20Complete%20Mono%20Windows%20Compatible.ttf

(see this issue for more info: ryanoasis/nerd-fonts#269)

@markwragg
markwragg / Write-Human.ps1
Last active May 18, 2024 21:16
A PowerShell function to output text to screen as if typed by a human. I don't know why I wrote this.
Function Write-Human {
<#
.SYNOPSIS
Use to output text as if typed by a human.
.SYNOPSIS
This script takes one or more strings and prints them to the screen with a slightly randomised delay between each character to emulate a human typing.
.EXAMPLE
Get-Content .\mytestfile.txt | Write-Human
#>
[cmdletbinding()]
@markwragg
markwragg / Open-GitUrl.ps1
Last active February 7, 2023 13:26
A PowerShell function to open the remote URL in the default browser for the git repo folder you are currently in at the command-line.
function Open-GitUrl {
$RemoteURL = git config remote.origin.url
if ($RemoteURL) {
if ($RemoteURL -match '\.git$') { $RemoteURL = $RemoteURL -replace '\.git$','/' }
if ($IsMacOS) {
open $RemoteURL
@NickCraver
NickCraver / Craver-Paradox.ps1
Last active April 20, 2022 03:05
My PowerShell PoshGit theme (used with Cmder)
#requires -Version 2 -Modules posh-git
# This is a tweaked version of https://github.com/JanJoris/oh-my-posh/blob/master/Themes/Paradox.psm1
function Write-Theme {
param(
[bool]
$lastCommandFailed,
[string]
$with
)
@lukas-h
lukas-h / license-badges.md
Last active June 14, 2024 16:35
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)