- Injection (SQL etc.)
- Broken Authentication
- Sensitive Data Exposure
- XML External Entities (XXE)
- Broken Access Control
- Security Misconfiguration
- Cross-Site Scripting (XSS)
- Insecure Deserialization
This file contains 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
echo '[1, 2, 3]' | ConvertFrom-Json | measure | |
# Count: 1 | |
(echo '[1, 2, 3]' | ConvertFrom-Json) | measure | |
# Count: 3 | |
echo '[1, 2, 3]' | ConvertFrom-Json | ConvertTo-Json | |
#{ | |
# "value": [ | |
# 1, |
This file contains 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 | |
[CmdletBinding()] | |
param( | |
[string] $Name | |
) | |
$ErrorActionPreference = 'Stop' | |
if (-not [System.IO.Path]::GetExtension($Name)) { |
This file contains 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/sh | |
SUBDIRECTORY_OK=1 | |
OPTIONS_SPEC='git go [options] [branch] | |
-- | |
b,branch create and checkout a new branch | |
' | |
. "$(git --exec-path)/git-sh-setup" |
This file contains 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 | |
sed -nE 's/^\s*(\S+)\s+\S+\s+(\S+)\s+\[([^]]*)\]\s+"(\S+)\s+(\S+)[^"]*"\s+(\S+)\s+(\S+)\s+"([^"]*)"\s+"([^"]*)".*/\1\n\2\n\3\n\4\n\5\n\6\n\7\n\8\n\9\x00/p' | | |
while IFS=$'\n' read -r -d $'\0' ip user timestamp method url status bytes referrer useragent; do | |
echo $method $url; | |
done | |
#while IFS= read -r line; do | |
# #mapfile -t parts < <(printf '%s\n' "$line" | IFS=$'\n' xargs -n1 printf '%s\n') | |
# mapfile -t parts < <(printf '%s\n' "$line" | sed -nE 's/^\s*(\S+)\s+\S+\s+(\S+)\s+\[([^]]*)\]\s+"(\S+)\s+(\S+)[^"]*"\s+(\S+)\s+(\S+)\s+"([^"]*)"\s+"([^"]*)".*/\1\n\2\n\3\n\4\n\5\n\6\n\7\n\8\n\9/p') |
This file contains 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
PS > [bool] ($null -eq $null) | |
True # Makes sense | |
PS > [bool] (@($null) -eq $null) | |
False # As expected, but not for the reason you think | |
PS > [bool] (@($null, $null) -eq $null) | |
True # What?!? | |
PS > [bool] (-null -eq @($null, $null)) | |
False # Much better, hence "$null should be on the left side of equality comparisons" | |
This file contains 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
const nullableDinero = ({ amount, ...rest }) => { | |
if (amount === null) { | |
return nullDinero; | |
} | |
let realDinero = Dinero({ amount, ...rest }); | |
let wrapper = Object.create(realDinero); // delegate to realDinero by default | |
for (let method of ['add', 'subtract']) { // extend specific methods | |
wrapper[method] = other => other === nullDinero |
This file contains 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
// For a runnable version, see: https://jsbin.com/caboqij/edit?js,console | |
function MyError() { | |
this._error = Error.apply(this, arguments); | |
this.message = this._error.message; | |
if (Error.captureStackTrace) { | |
Error.captureStackTrace(this, MyError); | |
} | |
} |