The python regex structure is mostly this
re.<method>
is the go to interface with common signature as (pattern, string, flags=0)
and most of the time there is an equivalent
Pattern.<method>
with the first argument being the string
instead of pattern
But the <method>
has [, pos[, endpos]]
and no flags=0
which might be useful
So I will omit all the equivalent methods' signatures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prime checking regex, which this code is based off of | |
// https://regex101.com/r/RIJkGF/1 | |
type StringDivisible<n extends string, div extends string> = n extends `` ? true : n extends `${div}${infer r}` ? StringDivisible<r, div> : false; | |
type Substrings<n extends string, d extends string = ""> = n extends `${d}${infer r}` ? readonly [` ${d}`, ...Substrings<r, ` ${d}`>] : readonly []; | |
type StringFactors<n extends string> = Substrings<n> extends readonly [unknown, ...infer R extends readonly string[], unknown] ? R : never; | |
type StringIsPrime<n extends string, Factors extends readonly string[] = StringFactors<n>> = Factors extends readonly [infer s extends string, ...infer R extends readonly string[]] ? StringDivisible<n, s> extends true ? false : StringIsPrime<n, R> : true; | |
type RepeatStringByStringDigit<str extends string, d extends string> = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! This is a solution to the HackerRank problem, Two Array Problem. | |
//! | |
//! https://www.hackerrank.com/challenges/weird-queries/problem | |
//! | |
//! The array manipulation operations aren't too difficult. I wouldn't even | |
//! classify them as tedious. The challenge is to find a way to get the bounding | |
//! circle of the points. | |
//! | |
//! The bounding circle can be found with Welzl's Algorithm. There are a number | |
//! of example implementations of the algorithm that can be gleaned from. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -RunAsAdministrator | |
# Unlock-PowerCfg - v22.05.11 | |
# Disable "Connected Standby" | |
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Power' -Name 'CSEnabled' -Value 0 -Force | |
# Get Power Settings entries and add/set 'Attributes' to 2 to unhide | |
$PowerCfg = (Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings' -Recurse).Name -notmatch '\bDefaultPowerSchemeValues|(\\[0-9]|\b255)$' | |
foreach ($item in $PowerCfg) { Set-ItemProperty -Path $item.Replace('HKEY_LOCAL_MACHINE','HKLM:') -Name 'Attributes' -Value 2 -Force } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while ($true) { | |
$Red = Get-Random -SetSeed (Get-Date).Ticks.ToString().Substring(10,8) -Maximum 255 | |
$Green = Get-Random -SetSeed (Get-Date).Ticks.ToString().Substring(10,8) -Maximum 255 | |
$Blue = Get-Random -SetSeed (Get-Date).Ticks.ToString().Substring(10,8) -Maximum 255 | |
Write-Host -Object ("$([char]27)[38;2;{0};{1};{2}mtrevor" -f $Red, $Green, $Blue) | |
} |
error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
sudo apt-get install libnss3
error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory
sudo apt-get install libxss1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Script to Initialize my custom powershell setup. | |
.DESCRIPTION | |
Script uses scoop | |
.NOTES | |
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted. | |
Author: Mike Pruett | |
Date: October 18th, 2018 |