Last active
September 28, 2016 14:56
-
-
Save dergachev/5766167 to your computer and use it in GitHub Desktop.
Revisions
-
dergachev revised this gist
Sep 25, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,7 @@ Would you prefer to see the following? Then simply append this snippet to your command, as follows: ```bash vagrant provision 2>&1 | ruby -ne 'puts "\e[33m" + Time.now().strftime("%T.%L") + "\e[0m " + $_' ``` @@ -48,7 +48,7 @@ vagrant up 2>&1 | prepend-timestamp Then do the following: ```bash ## ## Creates a ~/bin folder and ensure it's in $PATH; ## via http://askubuntu.com/a/247422/194314 -
dergachev revised this gist
Sep 25, 2013 . 1 changed file with 19 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,26 +4,29 @@ Shell snippet that prepends a nice to a command's output. For example, here's the (snipped) output of `vagrant provision`: ``` Successfully installed bundler-1.3.5 1 gem installed Using rmagick (2.13.2) Using bundler (1.3.5) Use `bundle show [gemname]` to see where a bundled gem is installed. [default] Running provisioner: shell... [default] Running: inline script ``` Would you prefer to see the following? ``` 18:32:05.055 Successfully installed bundler-1.3.5 18:32:05.055 1 gem installed 18:32:05.282 Using rmagick (2.13.2) 18:32:05.282 Using bundler (1.3.5) 18:32:05.285 Use `bundle show [gemname]` to see where a bundled gem is installed. 18:32:05.291 [default] Running provisioner: shell... 18:32:05.789 [default] Running: inline script ``` Then simply append this snippet to your command, as follows: ``` vagrant provision 2>&1 | ruby -ne 'puts "\e[33m" + Time.now().strftime("%T.%L") + "\e[0m " + $_' -
dergachev revised this gist
Sep 25, 2013 . 1 changed file with 14 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,23 +4,23 @@ Shell snippet that prepends a nice to a command's output. For example, here's the (snipped) output of `vagrant provision`: > Successfully installed bundler-1.3.5 > 1 gem installed > Using rmagick (2.13.2) > Using bundler (1.3.5) > Use `bundle show [gemname]` to see where a bundled gem is installed. > [default] Running provisioner: shell... > [default] Running: inline script Would you prefer to see the following? > **18:32:05.055** Successfully installed bundler-1.3.5 > **18:32:05.055** 1 gem installed > **18:32:05.282** Using rmagick (2.13.2) > **18:32:05.282** Using bundler (1.3.5) > **18:32:05.285** Use `bundle show [gemname]` to see where a bundled gem is installed. > **18:32:05.291** [default] Running provisioner: shell... > **18:32:05.789** [default] Running: inline script Then simply modify the above command as follows: -
dergachev revised this gist
Sep 25, 2013 . 1 changed file with 15 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,22 +2,25 @@ Shell snippet that prepends a nice to a command's output. For example, here's the (snipped) output of `vagrant provision`: > Successfully installed bundler-1.3.5 > 1 gem installed > Using rmagick (2.13.2) > Using bundler (1.3.5) > Use `bundle show [gemname]` to see where a bundled gem is installed. > [default] Running provisioner: shell... > [default] Running: inline script Would you prefer to see the following? > **18:32:05.055** Successfully installed bundler-1.3.5 > **18:32:05.055** 1 gem installed > **18:32:05.282** Using rmagick (2.13.2) > **18:32:05.282** Using bundler (1.3.5) > **18:32:05.285** Use `bundle show [gemname]` to see where a bundled gem is installed. > **18:32:05.291** [default] Running provisioner: shell... > **18:32:05.789** [default] Running: inline script Then simply modify the above command as follows: -
dergachev revised this gist
Sep 25, 2013 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,15 +19,16 @@ Would you prefer to see the following? > **17:47:19:948** INFO environment: Initializing config... Then simply modify the above command as follows: ``` vagrant provision 2>&1 | ruby -ne 'puts "\e[33m" + Time.now().strftime("%T.%L") + "\e[0m " + $_' ``` Keep in mind the following: * `2>&1` redirects stderr to stdout (pipes only work on stdout) * `\e[33m` and `\e[0m` are terminal escape codes that make the text between them yellow * `%T` is HH:MM:SS and `%L` adds milliseconds in the time formatting command. -
dergachev revised this gist
Sep 25, 2013 . 1 changed file with 10 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,27 +4,19 @@ Shell snippet that prepends a nice to a command's output. For example, here's the (snipped) output of `VAGRANT_LOG=debug vagrant provision`: > INFO environment: Home path: /Users/dergachev/.vagrant.d > WARN environment: No local data path is set. Local data cannot be stored. > WARN environment: In a bundler environment, not loading environment plugins! > INFO environment: Running hook: environment_load > INFO environment: Initializing config... Would you prefer to see the following? > **17:47:19:938** INFO environment: Home path: /Users/dergachev/.vagrant.d > **17:47:19:939** WARN environment: No local data path is set. Local data cannot be stored. > **17:47:19:939** WARN environment: In a bundler environment, not loading environment plugins! > **17:47:19:939** INFO environment: Running hook: environment_load > **17:47:19:948** INFO environment: Initializing config... Then simply pipe the command to ` | ruby -ne 'puts "\e[33m" + Time.now().strftime("%T.%L") + "\e[0m " + $_'`, as follows: -
dergachev revised this gist
Sep 25, 2013 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,9 +17,13 @@ For example, here's the (snipped) output of `VAGRANT_LOG=debug vagrant provision Would you prefer to see the following? > **17:47:19:938** INFO environment: Home path: /Users/dergachev/.vagrant.d > **17:47:19:939** WARN environment: No local data path is set. Local data cannot be stored. > **17:47:19:939** WARN environment: In a bundler environment, not loading environment plugins! > **17:47:19:939** INFO environment: Running hook: environment_load > **17:47:19:948** INFO environment: Initializing config... -
dergachev revised this gist
Sep 25, 2013 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,9 +5,13 @@ Shell snippet that prepends a nice to a command's output. For example, here's the (snipped) output of `VAGRANT_LOG=debug vagrant provision`: > INFO environment: Home path: /Users/dergachev/.vagrant.d > WARN environment: No local data path is set. Local data cannot be stored. > WARN environment: In a bundler environment, not loading environment plugins! > INFO environment: Running hook: environment_load > INFO environment: Initializing config... Would you prefer to see the following? -
dergachev revised this gist
Sep 25, 2013 . 1 changed file with 18 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,19 +2,27 @@ Shell snippet that prepends a nice to a command's output. For example, here's the (snipped) output of `VAGRANT_LOG=debug vagrant provision`: > INFO environment: Home path: /Users/dergachev/.vagrant.d > WARN environment: No local data path is set. Local data cannot be stored. > WARN environment: In a bundler environment, not loading environment plugins! > INFO environment: Running hook: environment_load > INFO environment: Initializing config... Would you prefer to see the following? > **17:47:19:938** INFO environment: Home path: /Users/dergachev/.vagrant.d > **17:47:19:939** WARN environment: No local data path is set. Local data cannot be stored. > **17:47:19:939** WARN environment: In a bundler environment, not loading environment plugins! > **17:47:19:939** INFO environment: Running hook: environment_load > **17:47:19:948** INFO environment: Initializing config... Then simply pipe the command to ` | ruby -ne 'puts "\e[33m" + Time.now().strftime("%T.%L") + "\e[0m " + $_'`, as follows: ``` VAGRANT_LOG=debug vagrant provision 2>&1 | ruby -ne 'puts "\e[33m" + Time.now().strftime("%T.%L") + "\e[0m " + $_' ``` Keep in mind the following: -
dergachev revised this gist
Sep 25, 2013 . 1 changed file with 40 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,31 +1,61 @@ # prepend-timestamp Shell snippet that prepends a nice to a command's output. ``` 17:47:19:938 INFO environment: Home path: /Users/dergachev/.vagrant.d 17:47:19:939 WARN environment: No local data path is set. Local data cannot be stored. 17:47:19:939 WARN environment: In a bundler environment, not loading environment plugins! 17:47:19:939 INFO environment: Running hook: environment_load 17:47:19:948 INFO environment: Initializing config... ``` To use it via copy and paste, just replace `vagrant provision` in the following snippet with your own command: ``` vagrant provision 2>&1 | ruby -ne 'puts "\e[33m" + Time.now().strftime("%T.%L") + "\e[0m " + $_' ``` Keep in mind the following: * `2>&1` redirects stderr to stdout, which allows the script to work on it too. * `\e[33m` and `\e[0m` are terminal escape codes that make the text between them yellow * `%T` is HH:MM:SS and `%L` adds milliseconds in the time formatting command. ## Installing the script Prefer to invoke the script in a friendlier way? ```bash vagrant up 2>&1 | prepend-timestamp ``` Then do the following: ``` ## ## Creates a ~/bin folder and ensure it's in $PATH; ## via http://askubuntu.com/a/247422/194314 ## mkdir ~/bin cat - >> ~/.bashrc <<'EOT' # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi EOT source ~/.bashrc ## ## Installs ~/bin/prepend-timestamp and makes it executable ## cat - > ~/bin/prepend-timestamp <<'EOT' #!/bin/sh ruby -ne 'puts "\e[33m" + Time.now().strftime("%T.%L") + "\e[0m " + $_' EOT chmod u+x ~/bin/prepend-timestamp ``` Done! -
dergachev revised this gist
Sep 25, 2013 . 2 changed files with 31 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ To use it via copy and paste, just modify the following: ``` vagrant provision 2>&1 | ruby -ne 'puts "\e[33m" + Time.now().strftime("%T:%L") + "\e[0m " + $_' ``` To install it: ``` mkdir ~/bin # see http://askubuntu.com/a/247422/194314 cat - >> ~/.bashrc <<'EOT' # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi EOT cat - > ~/bin/prepend-timestamp <<'EOT' #!/bin/sh ruby -ne 'puts "\e[33m" + Time.now().strftime("%T:%L") + "\e[0m " + $_' EOT chmod u+x ~/bin/prepend-timestamp ``` After installing it, use it like this: ``` vagrant up 2>&1 | prepend-timestamp ``` This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +0,0 @@ -
dergachev revised this gist
Sep 24, 2013 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ # example usage as script: # vagrant up | bash prepend-timestamp.sh # or directly as a snippet: # vagrant up | ruby -ne 'puts "\e[33m" + Time.now().strftime("%T") + "\e[0m " + $_' ruby -ne 'puts "\e[33m" + Time.now().strftime("%T") + "\e[0m " + $_' -
dergachev renamed this gist
Jun 12, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
dergachev revised this gist
Jun 12, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,3 @@ # example usage: # vagrant up | bash prepend-timestamp.sh ruby -ne 'puts "\e[33m" + Time.now().strftime("%T") + "\e[0m " + $_' -
dergachev created this gist
Jun 12, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ # example usage: vagrant up | bash prepend-timestamp.sh ruby -ne 'puts "\e[33m" + Time.now().strftime("%T") + "\e[0m " + $_'