Skip to content

Instantly share code, notes, and snippets.

View emilefraser's full-sized avatar

Emile Fraser emilefraser

View GitHub Profile
@exospheredata
exospheredata / toybox_v1.0.0.tests.ps1
Created February 6, 2017 19:03
Example Pester test for a PowerShell v5 Class
# Begin Testing
try
{
InModuleScope -ModuleName ToyBox -ScriptBlock {
Function Set-ObjectMockProperties ($object,[switch]$Exists)
{
# This function will load the object and set the global script variables with the values supplied.
# By doing this, we can later easily change how we interact with the object and make edits along
# the way in other Mocks or Tests.
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active November 3, 2024 22:54
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \