Skip to content

Instantly share code, notes, and snippets.

@mlegls
Last active January 18, 2023 19:29
Show Gist options
  • Save mlegls/478c11fbc19aeddb66a25d365d0a58ae to your computer and use it in GitHub Desktop.
Save mlegls/478c11fbc19aeddb66a25d365d0a58ae to your computer and use it in GitHub Desktop.
/ ngn/k
\d http
s:{$[`C=@x;x;$x]} / string
qs:{"'",(s x),"'"} / quote string
cp:{$[1~#p:$x;"-",p;"--",p]} / command param
c:{" "," "/(cp'!x),'" ",'qs'.x} / cp list
q:{"?","&"/($!x),'"=",'s'.x}. / dict -> qstring
gr:{."\\curl -Gs ",qs x} / GET raw
g:{gr x,(q y)} / GET[url;qs]
pr:{."\\curl -s -X POST ",(qs x),c y} / POST[url;args], e.g. pr["a.com";`user`T!("u:pass";"d.txt")]
p:{pr[x;`H`d!("Content-Type: application/json";`j@y)]} / json POST[url;data]
\d .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment