{"id":1392,"date":"2023-09-10T12:02:28","date_gmt":"2023-09-10T11:02:28","guid":{"rendered":"https:\/\/blog.thomarite.uk\/?p=1392"},"modified":"2023-11-11T18:41:40","modified_gmt":"2023-11-11T18:41:40","slug":"curl-yaml-scalars-elixir-git-stash","status":"publish","type":"post","link":"https:\/\/blog.thomarite.uk\/index.php\/2023\/09\/10\/curl-yaml-scalars-elixir-git-stash\/","title":{"rendered":"Curl, Yaml, scalars, Elixir, git stash"},"content":{"rendered":"\n<p>I haven&#8217;t watched this <a href=\"https:\/\/daniel.haxx.se\/blog\/2023\/08\/08\/mastering-the-curl-command-line\/\">video<\/a>, but looks like the holly book of curl!!!<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">I'd recommend starting at ~34 minutes.\n\n\u00b7You can specify multiple URLS with multiple output options in a single command. Doing this or using globbing (see below) to the same host will use persistent connections and greatly improve performance because the same L5 session is used\n\n\u00b7trurl is also made by the project and allows you to programmatically manipulate URLs (change server, path, query parameters, etc.). Pretty neat: https:\/\/github.com\/curl\/trurl\n\n\u00b7curl supports URL globbing: curl https:\/\/{ftp,www,test}.example.com\/img[1-22].jpg -o \"foo_#2_#1.jpg\"\n\n\u00b7By default, curl will resolve requests serially when multiple URLS or globbing is specified, but curl is capable of doing parallel transfers with the -Z or --parallel option. And can do anywhere from 2-300 transfers in parallel. This also has the potential to parallel-ize HTTP\/3 transfers even from single URLs.\n\n\u00b7You can do curl --help category to get a list of help categories for narrowing down options by categories like http or output\n\n\u00b7 Long commands for curl can be specified in a file and given to curl either via stdin or -K \/ --config - These files are essentially just command lines in a file\n\n\u00b7You can use the --trace option to provide tcpdump type output from curl. Saving the need to to start tcpdump in the background if you just want to see what's happening from curl\n\n\u00b7You can use --connect-to to specify a different DNS name to go to (instead of the one specified in the URL) which is similar to the --resolve option, but doesn't require the user to lookup the IP address ahead of time\n\n\u00b7You can override the DNS server that you use to resolve URLs via --dns-ipv4-addr 8.8.8.8 for example\n\n\u00b7You can add --libcurl to any curl command and it will spit out C source-code that implements the same command line in C via the library libcurl\n\n\u00b7You can set the environment variable SSLKEYLOGFILE to a file name and it will save the runtime TLS secrets to that file, and use that file in WireShark along with a dump of the traffic from tcpdump to see the contents of encrypted HTTP streams\n\n\u00b7You can choose to only download files that have changed since the last time they were downloaded with curl via --etag-save &lt;etag_file> and --etag-compare &lt;etag_file>\n\n\u00b7You can skip adding the extra -H \"Content-Type: application\/json\" when getting or posting JSON data (with -d), by specifying --json instead of just -d\n\n\u00b7You can create JSON easily from the command line with the tool jo: https:\/\/github.com\/jpmens\/jo (basically a reverse jq)<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Rant about <a href=\"https:\/\/ruudvanasseldonk.com\/2023\/01\/11\/the-yaml-document-from-hell\">yaml<\/a>. And something I learned about yaml some months ago and forgot about it: <a href=\"https:\/\/yaml-multiline.info\/\">scalars<\/a> for making multiline work in yaml.<\/p>\n\n\n\n<p><a href=\"https:\/\/paraxial.io\/blog\/elixir-savings\">Elixir<\/a>: a programming language based on Erlang. Really impressive reports! But still I would like to learn golang (if I ever learn properly python \ud83d\ude42<\/p>\n\n\n\n<p><a href=\"https:\/\/git-scm.com\/docs\/git-stash\">git stash<\/a>: I didnt know about this git command until last week, very handy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I haven&#8217;t watched this video, but looks like the holly book of curl!!! I&#8217;d recommend starting at ~34 minutes. \u00b7You can specify multiple URLS with multiple output options in a single command. Doing this or using globbing (see below) to the same host will use persistent connections and greatly improve performance because the same L5 &hellip; <a href=\"https:\/\/blog.thomarite.uk\/index.php\/2023\/09\/10\/curl-yaml-scalars-elixir-git-stash\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Curl, Yaml, scalars, Elixir, git stash&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,21,23],"tags":[],"class_list":["post-1392","post","type-post","status-publish","format-standard","hentry","category-unix","category-automation","category-programming"],"_links":{"self":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/1392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/comments?post=1392"}],"version-history":[{"count":3,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/1392\/revisions"}],"predecessor-version":[{"id":1465,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/1392\/revisions\/1465"}],"wp:attachment":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/media?parent=1392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/categories?post=1392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/tags?post=1392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}