Skip to content

Instantly share code, notes, and snippets.

Pattern:
^[.]([0-9neswud]*)$
Script:
speedwalk(rex.gsub(rex.gsub(matches[2],"([neswud])([neswud])","%11%2"),"([neswud])([neswud])","%11%2"),false,0,false)
@CodeAndLoathing
CodeAndLoathing / Convert-SunlessSkiesBytesToJson.ps1
Created July 16, 2019 20:46
Sunless Skies: convert .bytes files to .json files
#$PSVersionTable.PSVersion
#tested on PowerShell 6.2.1
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop
$WarningPreference = [System.Management.Automation.ActionPreference]::Inquire
# Location of Game Folders
$BASE_GAME_FOLDER = "C:\GOG Games\Sunless Skies"
$MANAGED_FOLDER = "{0}\Sunless Skies_Data\Managed" -f $BASE_GAME_FOLDER
$GAME_DATA = "{0}\..\LocalLow\Failbetter Games\Sunless Skies\storage\data" -f $env:APPDATA
$GAME_DATA_BACKUPS = "{0}\..\LocalLow\Failbetter Games\Sunless Skies\storage\data_backups" -f $env:APPDATA
@CodeAndLoathing
CodeAndLoathing / Get-CredentialFromFile.ps1
Created July 8, 2019 20:03
PowerShell : Get-CredentialFromFile.ps1 - Load a saved credential from a json file. If a value for "NewPlainTextPassword" is present then encrypt and overwrite the file.
function Get-CredentialFromFile {
param([System.IO.FileInfo]$Path)
$Credential = Get-Content $Path | ConvertFrom-Json
if ($Credential.NewPlainTextPassword) {
$Credential.Password = `
ConvertTo-SecureString $Credential.NewPlainTextPassword -AsPlainText -Force | `
ConvertFrom-SecureString
$Credential.NewPlaintextPassword = $null
@CodeAndLoathing
CodeAndLoathing / EnableSkypeVBSS.reg
Last active February 14, 2019 21:12
Office365 / Skype for Business : remove settings disabling VBSS if set in registry
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Lync]
"EnableConferenceScreenSharingOverVideo"=-
"EnableP2PScreenSharingOverVideo"=-
[HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Office\16.0\Lync]
"EnableConferenceScreenSharingOverVideo"=-
"EnableP2PScreenSharingOverVideo"=-
@CodeAndLoathing
CodeAndLoathing / DisableSkypeVBSS.reg
Last active February 14, 2019 21:12
Office365 / Skype for Business : disable VBSS (for resolving blurry screens during screen sharing)
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Lync]
"EnableConferenceScreenSharingOverVideo"=dword:00000000
"EnableP2PScreenSharingOverVideo"=dword:00000000
[HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Office\16.0\Lync]
"EnableConferenceScreenSharingOverVideo"=dword:00000000
"EnableP2PScreenSharingOverVideo"=dword:00000000
@CodeAndLoathing
CodeAndLoathing / O365-conversions.psm1
Last active July 8, 2019 20:05
Office365 : convert between O365 Immutable ID and Active Directory Object GUID
# Convert an on-premise Active Directory ObjectGUID from to corresponding O365 ImmutableID
function ConvertTo-ImmutableID {
param([parameter(Mandatory = $true)][Guid]$ObjectGUID)
return [System.Convert]::ToBase64String($ObjectGUID.ToByteArray())
}
# Convert an O365 ImmutableID to corresponding on-premise Active Directory ObjectGUID
function ConvertFrom-ImmutableID {
param([parameter(Mandatory = $true)][string]$ImmutableID)
return [Guid]::new([System.Convert]::FromBase64String($ImmutableID))
@CodeAndLoathing
CodeAndLoathing / Fiddler-RejectBadCertsWithoutPrompting.cs
Last active August 24, 2018 17:10
Fiddler : don't proceed on invalid certificates and don't prompt
// Description:
// This snippet changes the behavior of Fiddler to reject bad certificates automatically without prompting if you want to proceed.
// Instructions:
// Make sure Fiddler scripting language is set to C#
// Add to the Main() function of Fiddler's "Customize Rules..."
FiddlerApplication.OnValidateServerCertificate += (sender, ea) =>
{
if(ea.CertificatePolicyErrors != 0)
{
@CodeAndLoathing
CodeAndLoathing / O365EXOL-get-folderId.ps1
Created March 28, 2018 22:30
Office365 / Exchange Online : Get the folderId of a specified folder in a specified mailbox (to be used with SCC Content Searches)
#Specify target mailbox and folder to find folderid of
$TargetMailbox = "example@example.com"
$TargetFolderPath = "/Deleted Items"
$Credential = Get-Credential
#Connect to O365 Exchange Online
$EXOL_URI = "https://outlook.office365.com/powershell-liveid/"
$EXOL_Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $EXOL_URI -Credential $credential -Authentication Basic -AllowRedirection
Import-PSSession $EXOL_Session -AllowClobber
@CodeAndLoathing
CodeAndLoathing / O365EXOL-enable-mailboxAuditing.ps1
Last active July 8, 2019 20:07
Office365 / Exchange Online : Enable mailbox auditing for all mailboxes and make sure that desired settings for AuditAdmin, AuditOwner and AuditDelegate are set
#DESCRIPTION: this will enable mailbox auditing in Office365 / Exchange Online
# for all mailboxes and make sure the desired settings for
# AuditAdmin, AuditOwner, AuditDelegate is set for all mailboxes.
# Tested with Powershell 5.1
#Prompt for credentials
if ($Credential -eq $null) { $Credential = Get-Credential -Message "Enter your O365 credentials" }
#Connect to O365 EXOL
Get-PSSession | Remove-PSSession # cleanup any existing sessions
@CodeAndLoathing
CodeAndLoathing / HOSTS-UDL.xml
Last active August 15, 2020 21:31
Notepad++ : User defined language (UDL) file to format Windows HOSTS file
<NotepadPlus>
<UserLang name="HOSTS" ext="" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="1" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00# 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>