Skip to content

Instantly share code, notes, and snippets.

@Trucido
Created March 4, 2019 21:40
Show Gist options
  • Save Trucido/b7a7eca95868f9f68f543df9ee81de11 to your computer and use it in GitHub Desktop.
Save Trucido/b7a7eca95868f9f68f543df9ee81de11 to your computer and use it in GitHub Desktop.
<#
function tofileio {
[ -f "$1" ] && {
local filename="$1" Uri='https://file.io/';
curl -sL -F file=@"$filename" -H accept: application/json "$Uri" | { jq -r .link 2>/dev/null || cat; }
}
}
#>
function ToFileIO {
if (Test-Path $args[0] -type Leaf) {
$local:filename=$args[0]; $local:Uri='https://file.io/'
(curl.exe -sL -F file=@"$filename" -H accept: application/json "$Uri" | ConvertFrom-Json).link
}
}
<#
function pb {
[ -t 0 ] && {
[ -n "$1" ] && {
curl -sLF c=@"$1" https://ptpb.pw/?u=1; return
}
}
curl -sLF c=@- https://ptpb.pw/?u=1
}
#>
function PB {
if (!$PSCmdlet.MyInvocation.ExpectingInput -and !$MyInvocation.ExpectingInput) {
if ($args) {
return $(curl -sF c=@"$args" https://ptpb.pw/?u=1)
}
}
$input | curl -sF c=@- https://ptpb.pw/?u=1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment