Skip to content

Instantly share code, notes, and snippets.

View Chirishman's full-sized avatar
⚔️
I guess statuses are a thing now

Chirishman

⚔️
I guess statuses are a thing now
View GitHub Profile
#!/usr/bin/env python3
import re
from contextlib import closing
from epub import create_epub, DEFAULT_STYLESHEET
import requests
import requests_cache
from bs4 import BeautifulSoup
from smartypants import smartypants
@mac2000
mac2000 / ConvertTo-Markdown.ps1
Last active October 4, 2022 00:59 — forked from BenNeise/ConvertTo-Markdown.ps1
Converts a PowerShell object to a Markdown table.
<#
.Synopsis
Converts a PowerShell object to a Markdown table.
.EXAMPLE
$data | ConvertTo-Markdown
.EXAMPLE
ConvertTo-Markdown($data)
#>
Function ConvertTo-Markdown {
[CmdletBinding()]
@jesseschalken
jesseschalken / code_style.md
Last active April 24, 2024 17:27
Code style

My preferred code style is 2-space K&R. This is intended to provide a justification for this style.

Why K&R?

K&R style has the following properties:

  1. Provides symmetric size (in terms of screen space consumed) between the opening and closing syntax of a clode block.
  2. Forces no empty or meaningless lines, thereby avoiding artificial distance between related things that should be together.
  3. Consumes the minimum vertical space while keeping the opening and closing syntax of a block on separate lines from the content.
@Jaykul
Jaykul / Get-MsdnKeys.ps1
Last active August 3, 2022 20:28
PowerShell + Selenium Demo: Getting Started, and reusing cookies with Invoke-Request
# It might work in 4, but I'm not testing there. Lower you'll have to tweak code
#requires -Version 5.0
param(
# Your Live ID for MSDN login
[Parameter(Mandatory)]
[PSCredential]
[System.Management.Automation.CredentialAttribute()]
$Credential,
# Pick a browser to use. Defaults to Firefox (which doesn't seem to require an external Driver file)
@joelverhagen
joelverhagen / calls.txt
Created November 11, 2016 00:23
Variants of HTTP calls made by NuGet.exe list
[no Search()] nuget.exe list
[no Search()] nuget.exe list -allversions
[no Search(), no IsAbsoluteLatestVersion] nuget.exe list
[no Search(), no IsAbsoluteLatestVersion] nuget.exe list -allversions
GET /api/v2/Packages HTTP/1.1
GET /api/v2/Packages?$skip=100 HTTP/1.1
[no Search()] nuget.exe list -allversions -prerelease
[no Search(), no IsAbsoluteLatestVersion] nuget.exe list -allversions -prerelease
GET /api/v2/Packages()?$orderby=Id&$skip=0&$top=30 HTTP/1.1
@giordanocardillo
giordanocardillo / README.MD
Last active March 31, 2024 09:48
Remove Office 2016 Product Key
  1. Open a command prompt as Administrator
  2. In the command prompt, type the following:
  • Office 2016 (32-bit) on a 32-bit version of Windows

    cscript "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" /dstatus

  • Office 2016 (32-bit) on a 64-bit version of Windows

    cscript "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" /dstatus

  • Office 2016 (64-bit) on a 64-bit version of Windows

@evoelker
evoelker / Start-Progress.ps1
Last active February 17, 2022 14:55 — forked from ctigeek/Start-Sleep.ps1
Powershell sleep function, with progress bar.
function Sleep-Progress($seconds)
{
<#
.SYNOPSIS
Function to Start-Sleep with a progress bar
.DESCRIPTION
Runs the 'Start-Sleep' command using the with a progress bar. Time is passed to the function in seconds as an argument.
.NOTES
@brettmillerb
brettmillerb / DockerFile
Created April 5, 2019 21:59
Pwsh Dockerfile
# escape=`
ARG fromTag=latest
ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore
# Use server core as an installer container to extract PowerShell,
# As this is a multi-stage build, this stage will eventually be thrown away
FROM ${WindowsServerCoreRepo}:${fromTag} AS installer-env
ARG PS_VERSION=6.2.0
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/PowerShell-${PS_VERSION}-win-x64.zip
@Jaykul
Jaykul / About using NerdFonts as named Entities.md
Last active May 24, 2019 22:57
NerdFonts as Entities (thanks to Pansies)

Using Nerd Fonts in PowerShell

I've been recommending people use NerdFonts in their terminals for a while, but using the extra characters ends up being rather a pain. I have to look up characters in their web cheat-sheet, and then I either end up with a whole bunch of "$([char]0xf1ed)$([char]0xf00d)" in my profile scripts, which is impossible to read, or I have to translate the hex to decimal so I can type the ALT codes in my editor...

So today I fixed it, using PANSIES (the PowerShell ANSI Escape Sequences module).

PANSIES has &entities;

In PANSIES output (i.e. via the Write-Host, or by using New-Text in a string), you can embed named entities like in html. But unlike HTML, Pansies entities are extensible. So I wrote a little script to re-use the css names for the nerd-font characters and generate entities.

@joegasper
joegasper / ConvertTo-SRT.ps1
Last active July 10, 2023 01:53
Convert VTT files to SRT format
<#
.SYNOPSIS
Fast conversion of Microsoft Stream VTT subtitle file to SRT format.
.DESCRIPTION
Uses select-string instead of get-content to improve speed 2 magnitudes.
.PARAMETER Path
Specifies the path to the VTT text file (mandatory).
.PARAMETER OutFile
Specifies the path to the output SRT text file (defaults to input file with .srt).
.EXAMPLE