From b4b4dc501d0ca17033c9cf83a7fe79b9a6fae010 Mon Sep 17 00:00:00 2001 From: tomit4 Date: Mon, 23 Aug 2021 10:49:30 -0700 Subject: [PATCH] updated bashrc and created new curltime command --- bashrc.txt | 7 +++++++ curl-format.txt | 8 ++++++++ curl_notes.txt | 11 +++++++++++ 3 files changed, 26 insertions(+) create mode 100644 curl-format.txt diff --git a/bashrc.txt b/bashrc.txt index df554ce2..2450731c 100644 --- a/bashrc.txt +++ b/bashrc.txt @@ -139,6 +139,13 @@ ex () } # Custom Bash Commands +alias Code="cd ~/Documents/Code" alias js="cd ~/Documents/Code/javascript" +alias c++="cd ~/Documents/Code/c++" alias ls="ls -lah --color=auto" alias notes="cd ~/Documents/notes" +alias firefox="firefox-developer-edition" +alias thinkorswim="/home/brian/thinkorswim/thinkorswim" +alias shutdown="shutdown -h now" +alias docs="cd ~/Documents" +alias curltime="curl -w \"@$HOME/Documents/notes/curl-format.txt\" -o /dev/null -s" diff --git a/curl-format.txt b/curl-format.txt new file mode 100644 index 00000000..eba37aee --- /dev/null +++ b/curl-format.txt @@ -0,0 +1,8 @@ + time_namelookup: %{time_namelookup}s\n + time_connect: %{time_connect}s\n + time_appconnect: %{time_appconnect}s\n + time_pretransfer: %{time_pretransfer}s\n + time_redirect: %{time_redirect}s\n + time_starttransfer: %{time_starttransfer}s\n + ----------\n + time_total: %{time_total}s\n diff --git a/curl_notes.txt b/curl_notes.txt index e8ba504a..c1a1c740 100644 --- a/curl_notes.txt +++ b/curl_notes.txt @@ -9,3 +9,14 @@ curl -X DELETE http://localhost:3000/maria_database -H "Content-Type: applicatio Simple JSON PUT request: curl -X PUT http://localhost:3000/maria_database -H "Content-Type: application/json" -d '{"updated": "WE DID THIS IN CURL AGAIN", "previous": "DONE IN CURL"}' + +##################### +Based off a Stack Overflow Post, I was able to find a way to create a command called curltime that will perform the curl command but output various timestamps regarding +how long the request/response took, this gives it a bit more functionality similar to Postman. Make sure to hang onto the curl-format.txt file in your notes and keep the +alias curltime in your .bashrc file. Then, if doing a simple GET request it's as simple as writing: + +curltime http://localhost:3000/maria_database + +You can easily POST, DELETE and PUT as well using it very much like curl: + +curltime -X POST http://localhost:3000/maria_database -H "Content-Type: applicaton/json" -d '{"task": "DONE IN CURL"}'