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
| function Base62Encode([string] $inputStr = [Guid]::NewGuid().ToString()) | |
| { | |
| [byte[]] $byteArr = [system.Text.Encoding]::UTF8.GetBytes($inputStr) | |
| $converted = BaseConvert $byteArr 256 62 | |
| $sb = [System.Text.StringBuilder]::new() | |
| for ($i = 0; $i -lt $converted.Length; $i++) { | |
| $sb.Append($CharacterSet[$converted[$i]]) | Out-Null | |
| } | |
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
| # Already case-insensitive. Use -cmatch and -creplace for case-sensitive matching and replacement. | |
| (Get-Content input.json) ` | |
| -replace '\d{15,19}', {'*' * ($_.Value.Length-4) + $_.Value.Substring($_.Value.Length - 5, 4)} ` | |
| -replace '(\"expirationMonth\":)(\s*)("\d{1,2}")', '$1$2"**"' ` | |
| -replace '(\"expirationYear\":)(\s*)("\d{2,4}")', '$1$2"****"' ` | |
| -replace '(\"cvn\":)(\s*)("\d{3,4}")', '$1$2"***"' | | |
| Out-File output.json | |
| # Where $1 is the first group for example "CVN": and $2 is the second group (zero or more spaces) and $3 is the value. |
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
| SomePassword # Replace literal string 'SomePassword' with '***REMOVED***' (default) | |
| SomePassword==>examplePass # Replace with 'examplePass' instead | |
| SomePassword==> # Replace with the empty string | |
| regex:password=\w+==>password= # Replace, using a regex | |
| regex:\r(\n)==>$1 # Replace Windows newlines with Unix newlines | |
| regex:(?i)(passsWord)==> # Replace "password" insensitively | |
| regex:\"Number\":\s+\"\d+\"==>"Number: "***REMOVED***" # Remove number after "Number": | |
| # Ensure that multi-line flag is used (java -jar bfg.jar --multi-line-regex --replace-text bfg_replace.txt) | |
| regex:(?s)-----BEGIN RSA PRIVATE KEY-----(.+)-----END RSA PRIVATE KEY-----==>REMOVED |
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
| Enum PaymentTypes | |
| { | |
| Visa | |
| MasterCard | |
| AmericanExpress | |
| Discover | |
| JapanCreditBureau | |
| DinersClub | |
| } |
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 file was initially generated by Windows Terminal 1.2.2381.0 | |
| // It should still be usable in newer versions, but newer versions might have additional | |
| // settings, help text, or changes that you will not see unless you clear this file | |
| // and let us generate a new one for you. | |
| // To view the default settings, hold "alt" while clicking on the "Settings" button. | |
| // For documentation on these settings, see: https://aka.ms/terminal-documentation | |
| { | |
| "$schema": "https://aka.ms/terminal-profiles-schema", |
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
| param( | |
| [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$false)] | |
| [string] | |
| $secret, | |
| [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$false)] | |
| [string] | |
| $message | |
| ) |
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
| param( | |
| [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$false)] | |
| [string] | |
| $privateKey, | |
| [Parameter(Mandatory=$false, Position=1, ValueFromPipeline=$false)] | |
| [string] | |
| $delim = "\r\n" | |
| ) |
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
| #!/bin/bash. | |
| # Author: wind.TWD@gmail.com | |
| # Description: Used to replace exported Apigee proxy with expected pipeline tokens. Can be a pre-commit githook. | |
| # Notes: | |
| # Generally I wouldn't parse XML/HTML with regex, use xmlstarlet, but whatever. | |
| # Can run the commands without the -i to test. | |
| blue="\e[104m" | |
| normal=$(tput sgr0) | |
| proxy_name="PROXY_NAME" |
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
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.AspNetCore.Http.Features; | |
| using System; | |
| using System.Diagnostics.CodeAnalysis; | |
| using System.IO; | |
| using System.Threading.Tasks; | |
| namespace Starbucks.CustomerEngagement.Serilog.Enrichers.Tests | |
| { |
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
| using System.Text.Json.Serialization | |
| public void ConfigureServices(IServiceCollection services) | |
| { | |
| services.AddControllers().AddJsonOptions(opts => | |
| opts.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); | |
| } |