Skip to content

Instantly share code, notes, and snippets.

View Timberfang's full-sized avatar

Timberfang

  • 13:18 (UTC -05:00)
View GitHub Profile
@Timberfang
Timberfang / Move-Save.ps1
Created May 30, 2024 00:15
Move a game's save folder to your "Saved Games" folder, and create a link to the original
[CmdletBinding()]
param (
[Parameter()]
[string]
$Source,
[Parameter()]
[bool]
$SymbolicLink = $false,
@Timberfang
Timberfang / book.css
Created April 22, 2024 00:53
The CSS I use for formatting my fiction writing.
/* CC0 1.0 License (https://creativecommons.org/publicdomain/zero/1.0) */
body {
margin: auto;
padding-right: 1em;
padding-left: 1em;
max-width: 44em;
color: black;
font-family: Verdana, sans-serif;
font-size: 100%;
@Timberfang
Timberfang / Get-RandomString.ps1
Last active April 17, 2024 17:28
Create a random string using PowerShell
# MIT License
#
# Copyright (c) 2024 Timberfang
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@Timberfang
Timberfang / replace.js
Created February 28, 2024 01:33
Obsidian Longform plugin - replace text using regular expressions
// MIT License
//
// Copyright (c) 2024 Timberfang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@Timberfang
Timberfang / Wait-Disc.ps1
Created August 12, 2023 13:53
Wait for optical media to be inserted (DVD, Blu-Ray, CD, etc.), then end the function.
function Wait-Disc {
[CmdletBinding()]
param (
[Parameter()]
[int]
$DriveIndex = 0
)
# Derive drive letter
$DriveLetter = ($DriveInfo | Select-Object -ExpandProperty Drive)[$DriveIndex]
@Timberfang
Timberfang / Get-PerformanceStats.ps1
Last active May 29, 2023 12:08
Get the the CPU usage, RAM usage, and disk usage of the currently running computer.
<#
.SYNOPSIS
Get the the CPU usage, RAM usage, and disk usage of the currently running computer.
.DESCRIPTION
Retrieve the CPU, RAM, and disk usage of the current system.
Get-PerformanceStats assumes Megabytes as the default units, but it will switch to gigabytes if the megabyte values exceed 1,000.
.NOTES
Currently this script only supports Microsoft Windows.
.EXAMPLE
Get-PerformanceStats.ps1
<#
.SYNOPSIS
List basic information about the computer.
.DESCRIPTION
Lists the computer name, user account, OS, CPU model, GPU model, currently installed RAM, motherboard model, currently running antivirus,
local IP address, and public IP address.
This script currently runs only on Windows due to the lack of the Get-ComputerInfo, Get-PnpDevice, and Get-CimInstance cmdlets on MacOS and Linux.
.EXAMPLE
PS C:\>.\Get-SystemInfo.ps1
<#
.SYNOPSIS
Get the public and local IP addresses of the current computer.
.DESCRIPTION
Get the public and local IP addresses for the computer running the command. The local address can be retreived at any time,
as long as the computer is connected to a network. The public address depends on the website ident.me for retrieving the address.
If this website is down, the public address will not be displayed.
.EXAMPLE
PS C:\>.\Get-IPAddress.ps1
@Timberfang
Timberfang / Get-Repository.ps1
Created December 12, 2022 01:35
Download a GitHub repository from a list stored in a csv file. Requires git.
#Requires -Version 5.1
#Requires -Modules PowerShellForGitHub
Set-StrictMode -Version 3.0
function Read-Choice {
$Selection = $RepoList | Out-GridView -PassThru -Title 'Select one or more repositories'
if (-Not $Selection){Exit}
ForEach($Entry in $Selection) {
Get-Repository -OwnerName $Entry.Owner -RepositoryName $Entry.Repo
}
}
@Timberfang
Timberfang / Get-Release.ps1
Last active May 29, 2023 12:12
Download a GitHub release asset from a list stored in a csv file.
#Requires -Version 5.1
#Requires -Modules PowerShellForGitHub,PSMenu
Set-StrictMode -Version 3.0
$InformationPreference = 'Continue'
function Get-PrivateRelease {
<#
.SYNOPSIS
Download a release from a GitHub repository.