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
class AssertionException : System.Exception { | |
AssertionException ([string]$Message, [System.Exception]$InnerException) : base($Message,$InnerException) { } | |
} | |
function Assert-Contains { | |
param ( | |
[object[]]$Collection, | |
[string]$Property=$null, | |
$Pattern, |
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 Zip { | |
param ([object[]]$first, [object[]]$second) | |
[Func[object,object,object]]$zipper = { param ($a, $b) New-Object PSObject -Property @{First=$a;Second=$b} } | |
[System.Linq.Enumerable]::Zip($first, $second, $zipper) | |
} |
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
#!/usr/bin/env bash | |
showhelp=0 | |
verbose=0 | |
POSITIONAL=() | |
while [[ $# -gt 0 ]] | |
do | |
key="$1" |
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
ping /t 192.168.1.1 | select -Skip 2 | % { "$(Get-Date -Format 'o'),$_" } | Tee-Object -FilePath "$env:temp\ping-$(Get-Date -UFormat %s).csv" |
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
## Generate comment blocks that can denote regions in your script | |
filter HeaderComment { | |
[Alias('HC')] | |
param( | |
[Parameter(Position=0, ValueFromRemainingArguments)] | |
$msg | |
) | |
$msg = $msg -join ' ' | |
@" | |
################################################################################ |
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 lerp(a,b,t) return (1-t)*a + t*b end | |
function new_star() | |
local rx = love.math.random() * 20 | |
local ry = love.math.random() * 12 |
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
{ | |
"packages": [ | |
{ | |
"name": "Maixduino", | |
"maintainer": "Sipeed", | |
"websiteURL": "https://maixduino.sipeed.com", | |
"email": "[email protected]", | |
"help": { | |
"online": "https://maixduino.sipeed.com" | |
}, |
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
Add-Type -Language CSharp -TypeDefinition @" | |
using System; | |
using System.Globalization; | |
using System.Text.RegularExpressions; | |
public static class RegexUtilities | |
{ | |
// Examines the domain part of the email and normalizes it. | |
private static string DomainMapper(Match match) | |
{ |
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 | |
#------------------------------------------------------------------------------- | |
# draw-histogram - generates an ASCII-art histogram (bar chart) from input data. | |
#------------------------------------------------------------------------------- | |
# Expects a series of lines of the form `<category-name> <count>` to passed | |
# via stdin. | |
# | |
# Generates a table the looks something like the following: | |
# | |
# +-------+----+ |
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; | |
using System.Net; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
namespace SMM.Helper | |
{ | |
public static class CredentialsUI | |
{ | |
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] |