tag:blogger.com,1999:blog-49249663850280113612024-03-18T09:46:57.255-07:00MytechtodayBishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.comBlogger46125tag:blogger.com,1999:blog-4924966385028011361.post-61974327873272138662023-07-14T14:09:00.001-07:002023-07-14T14:09:40.144-07:00GPG PGP encryptions <h2 id="HowtoencryptanddecryptfilesusingGPG-VerifyInstallation:" style="background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 20px; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; padding: 0px;"><strong>Download GPG:<br class="auto-cursor-target" /></strong></h2><h2 id="HowtoencryptanddecryptfilesusingGPG-VerifyInstallation:" style="background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 20px; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; padding: 0px;"><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-radius: 3px; border: 1px solid rgb(223, 225, 229); color: #333333; font-size: 14px; letter-spacing: normal; margin: 10px 0px; overflow: auto; padding: 0px;"><div class="codeContent panelContent pdl" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; line-height: 20px; margin: 0px; overflow: hidden; padding: 0px;"><div style="margin: 0px; padding: 0px;"><div class="syntaxhighlighter sh-confluence nogutter java" id="highlighter_493579" style="font-size: 1em; margin: 0px; overflow: auto; padding: 0px; position: relative; width: 1605px;"><table border="0" cellpadding="0" cellspacing="0" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; color: #333333; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14px; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: 1605px;"><tbody style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><tr style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><td class="code" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 0px 15px; position: static; vertical-align: baseline; width: 1590px;"><div class="container" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 15px 0px 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 15px 0em; position: relative; vertical-align: baseline; white-space-collapse: preserve; width: auto;" title="Hint: double-click to select code"><div class="line number1 index0 alt2" data-bidi-marker="true" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 1em 0px 0em; position: static; vertical-align: baseline; white-space: nowrap; width: auto;"><code class="java plain" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; color: rgb(0, 0, 0) !important; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;">brew install gpg2<br />Or <br />sudo yum install gnupg<br />Or<br />sudo apt install gnupg<br />Or<br /><code class="java plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;">https:</code><code class="java comments" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; box-sizing: content-box; color: rgb(0, 130, 0) !important; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;">//gnupg.org/download/index.html</code></code></div></div></td></tr></tbody></table></div></div></div></div><strong>Verify Installation:<br class="auto-cursor-target" /></strong></h2><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="background-color: white; border-radius: 3px; border: 1px solid rgb(223, 225, 229); color: #333333; font-family: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; margin: 10px 0px; overflow: auto; padding: 0px;"><div class="codeContent panelContent pdl" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; line-height: 20px; margin: 0px; overflow: hidden; padding: 0px;"><div style="margin: 0px; padding: 0px;"><div class="syntaxhighlighter sh-confluence nogutter java" id="highlighter_493579" style="font-size: 1em; margin: 0px; overflow: auto; padding: 0px; position: relative; width: 1605px;"><table border="0" cellpadding="0" cellspacing="0" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14px; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: 1605px;"><tbody style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><tr style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><td class="code" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 0px 15px; position: static; vertical-align: baseline; width: 1590px;"><div class="container" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 15px 0px 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 15px 0em; position: relative; vertical-align: baseline; white-space-collapse: preserve; width: auto;" title="Hint: double-click to select code"><div class="line number1 index0 alt2" data-bidi-marker="true" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 1em 0px 0em; position: static; vertical-align: baseline; white-space: nowrap; width: auto;"><code class="java plain" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;">gpg --version</code></div></div></td></tr></tbody></table><h2 id="HowtoencryptanddecryptfilesusingGPG-GenerateKeyPair:" style="border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-size: 20px; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; padding: 0px;"><strong>Generate KeyPair:</strong></h2><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-radius: 3px; border: 1px solid rgb(223, 225, 229); margin: 10px 0px; overflow: auto; padding: 0px;"><div class="codeContent panelContent pdl" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; line-height: 20px; margin: 0px; overflow: hidden; padding: 0px;"><div style="margin: 0px; padding: 0px;"><div class="syntaxhighlighter sh-confluence nogutter java" id="highlighter_238761" style="font-size: 1em; margin: 0px; overflow: auto; padding: 0px; position: relative; width: 1605px;"><table border="0" cellpadding="0" cellspacing="0" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14px; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: 1605px;"><tbody style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><tr style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><td class="code" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 0px 15px; position: static; vertical-align: baseline; width: 1590px;"><div class="container" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 15px 0px 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 15px 0em; position: relative; vertical-align: baseline; white-space-collapse: preserve; width: auto;" title="Hint: double-click to select code"><div class="line number1 index0 alt2" data-bidi-marker="true" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 1em 0px 0em; position: static; vertical-align: baseline; white-space: nowrap; width: auto;"><code class="java plain" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;">gpg --gen-key</code></div></div></td></tr></tbody></table></div></div></div></div><p style="color: #172b4d; margin: 10px 0px 0px; padding: 0px;">You will be asked for your key details. Fill them out. You can leave the comment field empty. After that, you will be asked for a passphrase, and then you'll be given a prompt to type it. You can leave it empty if you want. But you need to remember what you type in if you put something (required for decryption later.)</p><h2 id="HowtoencryptanddecryptfilesusingGPG-ListallGPGkeypairs" style="border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-size: 20px; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; padding: 0px;"><strong>List all GPG key pairs</strong></h2><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-radius: 3px; border: 1px solid rgb(223, 225, 229); margin: 10px 0px; overflow: auto; padding: 0px;"><div class="codeContent panelContent pdl" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; line-height: 20px; margin: 0px; overflow: hidden; padding: 0px;"><div style="margin: 0px; padding: 0px;"><div class="syntaxhighlighter sh-confluence nogutter java" id="highlighter_609438" style="font-size: 1em; margin: 0px; overflow: auto; padding: 0px; position: relative; width: 1605px;"><table border="0" cellpadding="0" cellspacing="0" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14px; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: 1605px;"><tbody style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><tr style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><td class="code" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 0px 15px; position: static; vertical-align: baseline; width: 1590px;"><div class="container" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 15px 0px 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 15px 0em; position: relative; vertical-align: baseline; white-space-collapse: preserve; width: auto;" title="Hint: double-click to select code"><div class="line number1 index0 alt2" data-bidi-marker="true" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 1em 0px 0em; position: static; vertical-align: baseline; white-space: nowrap; width: auto;"><code class="java plain" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;">gpg --list-secret-keys</code></div></div></td></tr></tbody></table></div></div></div></div><h2 id="HowtoencryptanddecryptfilesusingGPG-ExportandshareyourPublicKey:" style="border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-size: 20px; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; padding: 0px;"><strong>Export your Public Key:</strong></h2><p style="color: #172b4d; margin: 10px 0px 0px; padding: 0px;">Once you've generated your keys, export your public key with the following command</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-radius: 3px; border: 1px solid rgb(223, 225, 229); margin: 10px 0px; overflow: auto; padding: 0px;"><div class="codeContent panelContent pdl" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; line-height: 20px; margin: 0px; overflow: hidden; padding: 0px;"><div style="margin: 0px; padding: 0px;"><div class="syntaxhighlighter sh-confluence nogutter java" id="highlighter_813745" style="font-size: 1em; margin: 0px; overflow: auto; padding: 0px; position: relative; width: 1605px;"><table border="0" cellpadding="0" cellspacing="0" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14px; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: 1605px;"><tbody style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><tr style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><td class="code" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 0px 15px; position: static; vertical-align: baseline; width: 1590px;"><div class="container" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 15px 0px 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 15px 0em; position: relative; vertical-align: baseline; white-space-collapse: preserve; width: auto;" title="Hint: double-click to select code"><div class="line number1 index0 alt2" data-bidi-marker="true" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 1em 0px 0em; position: static; vertical-align: baseline; white-space: nowrap; width: auto;"><code class="java plain" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;">gpg -export --armor firstName.lastName</code><code class="java color1" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; color: rgb(128, 128, 128) !important; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;">@youremail</code><code class="java plain" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;">.com</code></div></div></td></tr></tbody></table></div></div></div></div><h2 id="HowtoencryptanddecryptfilesusingGPG-ExportandshareyourPublicKey:" style="border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-size: 20px; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; padding: 0px;"><strong>Import others Public Key:</strong></h2><h2 id="HowtoencryptanddecryptfilesusingGPG-GenerateKeyPair:" style="border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-size: 20px; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; padding: 0px;"><p style="font-size: 14px; letter-spacing: normal; margin: 10px 0px 0px; padding: 0px;">Once you've generated your keys, export your public key with the following command</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-radius: 3px; border: 1px solid rgb(223, 225, 229); color: #333333; font-size: 14px; letter-spacing: normal; margin: 10px 0px; overflow: auto; padding: 0px;"><div class="codeContent panelContent pdl" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; line-height: 20px; margin: 0px; overflow: hidden; padding: 0px;"><div style="margin: 0px; padding: 0px;"><div class="syntaxhighlighter sh-confluence nogutter java" id="highlighter_813745" style="font-size: 1em; margin: 0px; overflow: auto; padding: 0px; position: relative; width: 1605px;"><table border="0" cellpadding="0" cellspacing="0" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14px; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: 1605px;"><tbody style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><tr style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><td class="code" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 0px 15px; position: static; vertical-align: baseline; width: 1590px;"><div class="container" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 15px 0px 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 0px 15px 0em; position: relative; vertical-align: baseline; width: auto;" title="Hint: double-click to select code"><div class="line number1 index0 alt2" data-bidi-marker="true" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px 1em 0px 0em; position: static; vertical-align: baseline; width: auto;"><span style="text-wrap: nowrap;">gpg --import abc_public.key</span></div><div style="white-space-collapse: preserve;"><code class="java plain" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;"><br /></code></div><div style="white-space-collapse: preserve;"><code class="java plain" style="background: none; border-radius: 0px; border: 0px; box-sizing: content-box; float: none; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; height: auto; inset: auto; line-height: 20px; margin: 0px; min-height: inherit; outline: 0px; overflow: visible; padding: 0px; position: static; vertical-align: baseline; width: auto;">And you can check the list of keys by
gpg --list-public-keys
</code></div></div></td></tr></tbody></table></div></div></div></div></h2><h2 id="HowtoencryptanddecryptfilesusingGPG-GenerateKeyPair:" style="border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-size: 20px; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; padding: 0px;"><br /></h2></div></div></div></div>Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-33923583219949460152023-05-05T10:28:00.008-07:002023-05-09T06:19:07.043-07:00ChatGPT, Benefits and Drawback !<p style="margin-bottom: 1.25em; margin-left: 0px;"><b><u>About ChatGPT</u></b></p><p style="margin-bottom: 1.25em; margin-left: 0px;"><b><u><br /></u></b></p><p style="margin-bottom: 1.25em; margin-left: 0px;">ChatGPT is an advanced language model developed by OpenAI that is capable of generating human-like responses to various inputs. It is based on the GPT-3.5 architecture and is currently one of the most advanced AI models available. The model has been trained on a massive corpus of text data, allowing it to generate coherent and meaningful responses to various queries.</p><p style="margin-bottom: 1.25em; margin-left: 0px;"><br /></p><p style="margin-bottom: 1.25em; margin-left: 0px;"><b><u>Benefits:</u></b></p><p style="margin-bottom: 1.25em; margin-left: 0px;"><b><u><br /></u></b></p><p style="margin-bottom: 1.25em; margin-left: 0px;">One of the primary benefits of ChatGPT is its ability to learn from vast amounts of data and use that knowledge to generate responses to various queries. This makes it a powerful tool for tasks such as language translation, content generation, and customer service. ChatGPT's ability to generate human-like responses also makes it an ideal tool for improving chatbot and virtual assistant technology.</p><p style="margin-bottom: 1.25em; margin-left: 0px;"><br /></p><p style="margin-bottom: 1.25em; margin-left: 0px;">Another benefit of ChatGPT is that it can help businesses automate their customer service processes. Chatbots that use ChatGPT can handle large volumes of customer queries without requiring human intervention. This can help businesses save time and money while improving customer satisfaction.</p><p style="margin-bottom: 1.25em; margin-left: 0px;"><b><u><br /></u></b></p><p style="margin-bottom: 1.25em; margin-left: 0px;"><b><u>Drawback of ChatGPT</u></b></p><p style="margin-bottom: 1.25em; margin-left: 0px;"><br /></p><p style="margin-bottom: 1.25em; margin-left: 0px;">However, there are also some drawbacks to ChatGPT. One of the main concerns is that the model may be prone to bias. The data used to train the model may be biased in various ways, which could lead to biased responses. Another concern is that ChatGPT may not always provide accurate responses. The model may generate responses that are not factually correct or that could be misleading.</p><p style="margin-bottom: 1.25em; margin-left: 0px;"><b><br /></b></p><p style="margin-bottom: 1.25em; margin-left: 0px;"><b>Summary:</b></p><p style="margin-bottom: 1.25em; margin-left: 0px;"><br /></p><p style="margin-bottom: 1.25em; margin-left: 0px;">Despite these concerns, it is important to note that ChatGPT is not something that humans should be scared of. The model is a tool that can be used to augment human intelligence, not replace it. Humans still have a critical role to play in ensuring that the responses generated by ChatGPT are accurate and unbiased.</p><p style="margin-bottom: 0px; margin-left: 0px;">In conclusion, ChatGPT is a powerful tool that has the potential to revolutionize many industries. Its ability to generate human-like responses to various queries makes it an ideal tool for language translation, content generation, and customer service. However, it is essential to be aware of the potential drawbacks and biases that may be present in the model. As long as humans remain vigilant and use ChatGPT responsibly, it can be a valuable asset that enhances our capabilities rather than a threat that replaces us.</p><p style="margin-bottom: 0px; margin-left: 0px;"><br /></p><p style="margin-bottom: 0px; margin-left: 0px;"><b><u>Tips using ChatGPT</u></b></p><p style="margin-bottom: 0px; margin-left: 0px;"><b><u><br /></u></b></p><p style="margin-bottom: 1.25em; margin-left: 0px;">Here are some tips for using ChatGPT effectively:</p><p style="margin-bottom: 1.25em; margin-left: 0px;"><br /></p><p style="margin-bottom: 0px; margin-left: 0px;"></p><ul style="text-align: left;"><li>Provide clear and specific prompts: ChatGPT works best when it has a clear idea of what you're asking it. Make sure your prompts are specific and clearly worded. Avoid using ambiguous or open-ended questions.</li><li>Use high-quality data: ChatGPT is only as good as the data it's trained on. If you're training your own version of ChatGPT, make sure you're using high-quality data that is relevant to your use case.</li><li>Fine-tune the model: Fine-tuning the model to your specific use case can improve its accuracy and relevance. This involves training the model on a smaller dataset that is specific to your domain.</li><li>Monitor responses for accuracy and bias: As with any AI tool, it's important to monitor ChatGPT's responses for accuracy and bias. Make sure you're reviewing its responses regularly and correcting any errors or biases that you identify.</li><li>Use in combination with human intervention: While ChatGPT can handle many tasks on its own, it's important to use it in combination with human intervention. Human oversight can help ensure that ChatGPT's responses are accurate and appropriate.</li><li>Experiment with different inputs and prompts: ChatGPT can be used for a wide variety of tasks, so don't be afraid to experiment with different inputs and prompts. This can help you identify new use cases and improve your overall results.</li><li>Be aware of ethical considerations: As with any AI tool, there are ethical considerations to be aware of when using ChatGPT. Make sure you're using it in a responsible and ethical manner, and that you're not contributing to bias or harm in any way.</li></ul><div><i>Note: This article was written by chatGPT</i></div><p></p><!--your section of the post that is going to be displayed on the main page goes here-->
<span class="fullpost">
<!---Your Hidden post goes here-->
</span>Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-71795427872530581402021-12-29T23:01:00.003-08:002021-12-29T23:01:55.595-08:00Find and copy File recursively on MAC terminalThe following command find allt he files with *jpeg extension with in the current folder/children folders recursicely and copy all the files to the ~/mac-photos folder<div><span style="font-family: courier;">$ find . -name "*.jpeg" -type f -exec cp {} ~/mac-photos \;
</span><span class="fullpost">
<!---Your Hidden post goes here-->
</span></div>Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-31134576209218856422021-11-08T16:44:00.003-08:002021-11-08T16:59:07.550-08:00Code to Split large file and keep the header row on each file<!--HTML generated using hilite.me-->
You can pass a single argument as the file name(Exclude the extension...) or you can modify the file to take extension as the arguments.
<div style="background: rgb(255, 255, 255); border-color: gray; border-image: initial; border-style: solid; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;"><pre style="line-height: 125%; margin: 0px;">
fileName=$1
splitFileNamePrefix="${fileName}_"
header=$(head -1 ${fileName}.dat)
split -l 40000 ${fileName}.dat splitFileNamePrefix
n=1
for f in splitFileNamePrefix*
do
prefixSplitNo=0
if [[ ${n} -gt 9 ]]; then
prefixSplitNo=''
fi
outputFileName="${splitFileNamePrefix}${prefixSplitNo}${n}.dat"
echo ${outputFileName}
if [[ ${n} -ne 1 ]]; then
echo ${header} > ${outputFileName}
fi
cat ${f} >> ${outputFileName}
rm ${f}
((n++))
done
</pre></div>
<span class="fullpost">
<!---Your Hidden post goes here-->
</span>Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-35590810376338153362020-09-12T20:42:00.012-07:002020-09-14T16:13:16.445-07:00Running a command as a service in Window!<div><br /></div><div><b>To create service:</b></div><div><span style="font-family: courier;"> sc.exe create YOUR_SERVICE_NAME binpath= <PATH_TO_YOUREXECUTABLE></span></div><div><span style="font-family: courier;"><b> </b></span></div><div><span style="font-family: courier;"><b>Example: </b>sc.exe create dockerDService binPath= "C:\Program Files\Docker\Docker\resources\dockerd.exe" </span><span face="SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace" style="background-color: #fafafa; color: #171717; font-size: 14px; white-space: pre;">start= auto</span></div><div><br /></div><div><br /></div><div><br /></div><div><b>To delete service:</b></div><div><b> </b> <span style="font-family: courier;">sc.exe delete SERVICE_NAME </span></div><div><span style="font-family: courier;"> E<b>xample </b>: sc.exe delete dockerDService </span></div><div><br /></div><div><b>Note</b>: <i>Use PowerShell or the command Terminal with Administrator mode</i></div>Nirma Parajulihttp://www.blogger.com/profile/05607038157201956574noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-14186065660081122462020-07-26T11:06:00.004-07:002020-07-26T12:07:00.132-07:00Backup(Transferring and Synchronizing files) using python multiprocessing and rsync !<code style="background: rgba(0, 0, 0, 0.05); border-radius: 2px; box-sizing: border-box; color: #202124; font-family: "roboto mono", monospace; font-size: 15px; line-height: 1; margin: 0px; padding: 2px 3px;">rsync(</code><span style="background-color: white; color: #202124; font-family: roboto, helvetica, sans-serif; font-size: 17px;">remote sync) is a utility for efficiently transferring and synchronizing files between a computer and an external storage</span><div><br /></div><div><ol style="background-color: white; box-sizing: border-box; color: #202124; font-size: 17px; line-height: 1.6; margin: 0px 0px 1.5rem; padding: 0px; text-align: left;"><li style="box-sizing: border-box; font-family: roboto, helvetica, sans-serif; line-height: 1.6; margin: 0px; padding: 0px;"><p style="box-sizing: border-box; letter-spacing: 0px; line-height: 1.6; margin: 0px 0px 24px; padding: 0px;">Copy or sync files locally:</p></li><li style="box-sizing: border-box; font-family: roboto, helvetica, sans-serif; line-height: 1.6; margin: 0px; padding: 0px;"><p style="box-sizing: border-box; letter-spacing: 0px; line-height: 1.6; margin: 0px 0px 24px; padding: 0px;"><span style="background-color: #28323f; color: #cccccc; font-family: "roboto mono", monospace; font-size: 13px; white-space: pre-wrap;">rsync -zvh [Source-Files-Dir] [Destination]</span></p></li><li style="box-sizing: border-box; font-family: roboto, helvetica, sans-serif; line-height: 1.6; margin: 0px; padding: 0px;"><p style="box-sizing: border-box; letter-spacing: 0px; line-height: 1.6; margin: 0px 0px 24px; padding: 0px;"><span style="letter-spacing: 0px; white-space: pre-wrap;">Copy or sync directory locally:</span></p></li><li style="box-sizing: border-box; font-family: roboto, helvetica, sans-serif; line-height: 1.6; margin: 0px; padding: 0px;"><p style="box-sizing: border-box; letter-spacing: 0px; line-height: 1.6; margin: 0px 0px 24px; padding: 0px;"><span style="background-color: #28323f; color: #cccccc; font-family: "roboto mono", monospace; font-size: 13px; white-space: pre-wrap;">rsync -zavh [Source-Files-Dir] [Destination]</span></p></li><li style="box-sizing: border-box; font-family: roboto, helvetica, sans-serif; line-height: 1.6; margin: 0px; padding: 0px;"><p style="box-sizing: border-box; letter-spacing: 0px; line-height: 1.6; margin: 0px 0px 24px; padding: 0px;"><span style="background-color: #28323f; color: #cccccc; font-family: "roboto mono", monospace; font-size: 13px; white-space: pre-wrap;"><span style="background-color: white; color: #202124; font-family: roboto, helvetica, sans-serif; font-size: 17px; white-space: normal;">Copy files and directories recursively locally:</span></span></p></li><li style="box-sizing: border-box; font-family: roboto, helvetica, sans-serif; line-height: 1.6; margin: 0px; padding: 0px;"><p style="box-sizing: border-box; letter-spacing: 0px; line-height: 1.6; margin: 0px 0px 24px; padding: 0px;"><span style="background-color: #28323f; color: #cccccc; font-family: "roboto mono", monospace; font-size: 13px; white-space: pre-wrap;">rsync -zrvh [Source-Files-Dir] [Destination] </span></p></li><li style="box-sizing: border-box; line-height: 1.6; margin: 0px; padding: 0px;"><h4 style="color: black; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-variant-ligatures: no-common-ligatures;"><b><font face="verdana">Sample python code script to do a backup using python...</font></b></span></h4></li><li style="box-sizing: border-box; line-height: 1.6; margin: 0px; padding: 0px;"><div><span style="font-variant-ligatures: no-common-ligatures;"><b><font face="verdana"><br /></font></b></span></div></li><li style="box-sizing: border-box; font-family: roboto, helvetica, sans-serif; line-height: 1.6; margin: 0px; padding: 0px;"><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">#!/usr/bin/env python</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">import subprocess</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">from multiprocessing import Pool</span></p><p class="p2" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 13px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">from os import walk<span class="Apple-converted-space"> </span></span></p><p class="p2" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 13px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">src= "/home/user/data/"</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">dest="/home/user/data/backup/"</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">def backupData(dir):</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>print("dir = "+ src+dir +" dest = " + dest+dir)</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>subprocess.call(["rsync", "-arq", src+dir, dest+dir])<span class="Apple-converted-space"> </span></span></p><p class="p2" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 13px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">dirList = []</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">for (root, dirs, files) in walk(src):</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>dirList.extend(dirs)</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>break;</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">print (dirList)</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">p= Pool(len(dirList))</span></p><p class="p1" style="color: black; font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">p.map(backupData, dirList)</span></p></li></ol></div>Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-2460624305530129612020-06-06T17:29:00.001-07:002020-06-06T17:29:19.475-07:00Cucumber/Gherkins with Java(kotlin) !<a href="#" id="https://cucumber.io/">Cucumber </a>is an opensource, Behavior-Driven Development (BDD) framework, where you execute your automated tests. You can pick up a regression suites for your automation test. We will mostly discuss about the the automation test written in Java/Kotlin in this tutorials.<div>Cucumber reads executable specifications written in plain text and validates that the software does what those specifications say.</div><div><br /></div><div><b>What is Gherkins:</b></div><div>Gherkins is a business readable domain specific language. It is a set of grammar rules that makes plain text structured enough for Cucumber to understand.</div><div>Example : <span style="background-color: white; font-family: consolas; font-size: 9.8pt;">Users are presented with Invalid Username/Password method when authentication fails</span></div><div><pre style="background-color: white; font-family: consolas; font-size: 9.8pt;"><b style="font-family: "Times New Roman"; font-size: medium; white-space: normal;">Scenarios: </b></pre><pre style="background-color: white; font-family: Consolas; font-size: 9.8pt;"><font face="Times New Roman"><span style="white-space: normal;">Cucumber uses Scenarios to defines the steps . You describe the Scenarios using <b>Given</b>, <b>When</b>, <b>And </b>and <b>Then, But</b> </span></font></pre><pre style="background-color: white; font-family: Consolas; font-size: 9.8pt;"><font face="Times New Roman"><span style="white-space: normal;">Example: </span></font></pre><pre style="background-color: white; font-family: Consolas; font-size: 9.8pt;"><pre style="font-family: Consolas; font-size: 9.8pt;"><span style="color: navy; font-weight: bold;">Scenario</span>: Users are presented with Invalid Username/Password method when authentication fails<br /> <span style="color: navy; font-weight: bold;">Given </span>User is in the login page<br /> <span style="color: navy; font-weight: bold;">when </span>User fills the invalid username or password<br /> <span style="color: navy; font-weight: bold;">And </span>User hit the submit button<span style="color: navy; font-weight: bold;"><br /></span> <span style="color: navy; font-weight: bold;">Then </span>User see the pop up screen saying Invalid Username/Password</pre><pre style="font-family: Consolas; font-size: 9.8pt;"><div style="font-family: "Times New Roman"; font-size: medium; white-space: normal;">When we define the <span style="color: navy; font-family: Consolas; font-size: 9.8pt; font-weight: bold;">Scenario, </span><span style="font-family: Consolas; font-size: 9.8pt;">we </span> can define multiple pre condition and multiple action and multiple expected outcomes.</div><div style="font-family: "Times New Roman"; font-size: medium; white-space: normal;"><br /></div><div style="font-family: "Times New Roman"; font-size: medium; white-space: normal;">We can collapse these two or more similar scenarios into a Scenario Outline as following</div><div style="font-family: "Times New Roman"; font-size: medium; white-space: normal;"><pre style="-webkit-font-smoothing: auto; background-color: #efefef; box-sizing: border-box; color: #212529; font-family: "Roboto Mono", monospace; font-size: 14px; margin-bottom: 1em; margin-top: 0px; overflow-wrap: normal; overflow: auto; padding: 1.25em 1.5em;"><code class="language-gherkin" style="-webkit-font-smoothing: auto; background-color: transparent; box-sizing: border-box; color: inherit; font-family: "Roboto Mono", monospace; font-size: inherit; padding: 0px; word-break: normal;">Scenario Outline: eating
Given there are <start> cucumbers
When I eat <eat> cucumbers
Then I should have <left> cucumbers
Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |</code></pre></div></pre></pre><pre style="background-color: white; font-family: Consolas; font-size: 9.8pt; text-align: right;">(src: <a href="cucumber.io">cucumber.io</a>)</pre><pre style="background-color: white; font-family: Consolas; font-size: 9.8pt;"><b style="font-family: "Times New Roman"; white-space: normal;">What is Feature and Feature File:</b></pre><pre style="background-color: white; font-family: Consolas; font-size: 9.8pt;"><font face="Times New Roman"><span style="white-space: normal;">Feature can be defined as a standalone business functionality of a project. Feature file describes the testing needs for any features. A features file can contains one or many scenarios for you automated testings.In order the automatically detect the features by cucumber framework, you need to define it with .feature file extension. You will normally have a desperate feature file for each feature. </span></font></pre><pre style="background-color: white; font-family: Consolas; font-size: 9.8pt;"><b style="background-color: #e67c73; font-family: "Times New Roman"; white-space: normal;">(This post is still in progress--- keep visit us again)</b></pre><pre style="background-color: white; font-family: Consolas; font-size: 9.8pt;"><b style="font-family: "Times New Roman"; white-space: normal;"><span> </span><br /></b></pre></div>Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-41519362297026053782020-06-02T15:18:00.002-07:002020-06-02T15:18:37.383-07:00Updating the hosts file in MAC<p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">echo '172.16.144.128 hdp hdp' | sudo tee -a /private/etc/hosts</span></p><!--your section of the post that is going to be displayed on the main page goes here-->
<span class="fullpost">
<!---Your Hidden post goes here-->
</span>Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-91968797588410514152020-05-16T22:16:00.002-07:002020-05-16T22:17:19.698-07:00Bash script to rename or move files from a directory !Following is the bash script that renames a sets of file form the current directoy. In the following is just updating the extension.<div><br /></div><div><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">#/bin/bash</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">for file in *.JPEG; do</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>name=$(basename "$file" .JPEG)</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>mv "$file" "$name.jpeg"</span></p><p class="p1" style="font-family: Menlo; font-size: 11px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span class="s1" style="font-variant-ligatures: no-common-ligatures;">done</span></p><div><br /></div><div><br /></div></div>Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-18608946449398578132020-04-20T13:30:00.002-07:002022-03-26T10:10:57.474-07:00Git - more on Git Tags - <div dir="ltr" style="text-align: left;" trbidi="on">
<!--your section of the post that is going to be displayed on the main page goes here-->
<span class="fullpost">
<!---Your Hidden post goes here-->
</span><br />
<div>
<br /></div>
<div>
<br /></div>
<div>
The following steps outlines the Git Tag delete process both locally and remotely.</div>
<div>
<ol style="text-align: left;">
<li> Fetch all the tags from<br /><span style="font-family: "courier new" , "courier" , monospace;">git fetch --tags</span></li>
<li>Delete the tag locally<br /><span style="font-family: "courier new" , "courier" , monospace;">git tag -d yourTagToDelete (eg: git tag -d v1.15.0)</span></li>
<li>Delete the tag in Remote<br /><span style="font-family: "courier new" , "courier" , monospace;">git push origin :yourTagToDelete (eg git push origin :v1.15.0)</span></li><li>Create a new tag locally<br /><span style="font-family: "courier new" , "courier" , monospace;">git tag yourNewTag (eg: git tag v1.15.0)</span></li><li>Push tag to Remote<br /><span style="font-family: "courier new" , "courier" , monospace;">git push origin yourTagToDelete (eg git push origin v1.15.0)</span></li>
</ol>
</div>
</div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-69957448371065324552020-04-18T08:46:00.001-07:002020-04-18T08:46:49.240-07:00Restarting Spring Boot Application !<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
Restarting Spring Boot Application !</div>
<div>
<br /></div>
You have several options to restart Spring boot Application . You can restart either of the following three options. Based on your requirement you can choose one of the following.<br />
<div>
<br /></div>
<div>
<ol style="text-align: left;">
<li>Using spring-boot-devtools</li>
<div>
Add your Gradle dependency</div>
<pre class="programlisting" style="background-color: #f8f8f8; border-radius: 3px; border: 1px solid rgb(204, 204, 204); clear: both; font-family: Consolas, "Liberation Mono", Courier, monospace; font-size: 15px; line-height: 1.4; overflow: auto; padding: 6px 10px;"> dependencies{
compileOnly(<span class="hl-string" style="color: #2a00ff;" xmlns:d="http://docbook.org/ns/docbook">"org.springframework.boot:spring-boot-devtools"</span>)
}</pre>
After that Add, you can simply add an end poing on your controller class and have the following:<br />
<span style="font-family: "consolas";"><span style="background-color: white; font-size: 9.8pt;">org.springframework.boot.devtools.restart.Restarter.getInstance().restart(); </span><span style="background-color: white; font-size: 13.0667px;"><br /></span></span><br />The <a href="https://stackoverflow.com/questions/34577936/spring-boot-devtools-causing-classcastexception-while-getting-from-cache">drawback of using tools is you cannot make a good used of @Cacheable . it might cause ClassCastException</a> while reading from the cache.<br /><br />
<li>Using RestartEndPoint from </li>
<div>
Add your Gradle dependency</div>
<pre class="programlisting" style="background-color: #f8f8f8; border-radius: 3px; border: 1px solid rgb(204, 204, 204); clear: both; line-height: 1.4; overflow: auto; padding: 6px 10px;"><span style="font-family: "consolas" , "liberation mono" , "courier" , monospace;"><span style="font-size: 15px;"> dependencies{
compile "org.springframework.boot:spring-boot-starter-actuator"
}</span></span></pre>
After that Add, you can simply add an end on your controller class and have the following:<br /><ol style="text-align: left;"><span style="font-family: "courier new" , "courier" , monospace;"> @Autowired</span></ol>
<ol style="text-align: left;"><span style="font-family: "courier new" , "courier" , monospace;"> RestartEndpoint restartEndpoint;</span></ol>
<ol style="text-align: left;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></ol>
<ol style="text-align: left;"><span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: Times, Times New Roman, serif;"> And call the following methond from your controller :</span></ol>
<ol style="text-align: left;"><span style="font-family: "courier new" , "courier" , monospace;"> restartEndpoint.restart() </span></ol>
<br />You might see NullPointer Exception while trying to bring the application up specially when you have UnderTow as your servlet container </ol>
<ol style="text-align: left;"> 3. And the third one is reading the current context and restarting it. You can simply add the following method on the Main Class and invoke from your controller</ol>
<div>
<pre style="background-color: white; font-family: Consolas; font-size: 9.8pt;"><span style="color: navy; font-weight: bold;"> public static void </span>restart() {
ApplicationArguments args = <span style="color: #660e7a; font-style: italic;">appContext</span>.getBean(ApplicationArguments.<span style="color: navy; font-weight: bold;">class</span>);
Thread thread = <span style="color: navy; font-weight: bold;">new </span>Thread(() -> {
<span style="color: #660e7a; font-style: italic;">appContext</span>.close();
SpringApplication springApplication = <span style="color: navy; font-weight: bold;">new </span>SpringApplication(MyBootApplication.<span style="color: navy; font-weight: bold;">class</span>);
springApplication.addListeners(<span style="color: navy; font-weight: bold;">new </span>ApplicationPidFileWriter());
<span style="color: #660e7a; font-style: italic;">appContext </span>=springApplication.run(<span style="color: #660e7a;">args</span>.getSourceArgs());
});
thread.setDaemon(<span style="color: navy; font-weight: bold;">false</span>);
thread.start();
}</pre>
</div>
</div>
</div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-76341475162366745712020-03-21T10:10:00.002-07:002020-03-21T10:10:09.876-07:00Thread Dumping in Unix - flyway recorder !<div dir="ltr" style="text-align: left;" trbidi="on">
jcmd 8308 JFR.start duration=100s filename=tempo.jfr<!-- your section of the post that is going to be displayed on the main page goes here -->
<span class="fullpost">
<!---Your Hidden post goes here -->
</span></div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-41244331093648921412020-03-05T08:36:00.004-08:002020-03-05T08:36:41.018-08:00Monogo Pipeline scripts !<div dir="ltr" style="text-align: left;" trbidi="on">
1. <b>Filter by an assistance of an array element in a document:</b><!-- your section of the post that is going to be displayed on the main page goes here --><span class="fullpost"><!---Your Hidden post goes here --></span><br />
<div style="text-align: left;">
</div>
<div style="text-align: left;">
$and:[{assessmentPeriods:{$ne:null, $exists:true, $ne: []}} ]<br />
<br />
2. </div>
<div>
</div>
<div>
<br /></div>
</div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-15729509141189070082019-04-05T14:14:00.000-07:002019-04-05T14:14:03.916-07:00Java 11 and Groovy Compatibility and JAXBContext ! <div dir="ltr" style="text-align: left;" trbidi="on">
<h4 style="text-align: left;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span><span style="font-family: inherit;">If you see the following error during compile : </span></h4>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">FAILURE: Build failed with an exception.</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">* What went wrong:</span><br />
<span style="font-family: Courier New, Courier, monospace;">Execution failed for task ':compileTestGroovy'.</span><br />
<span style="font-family: Courier New, Courier, monospace;">> org/codehaus/groovy/ast/MethodCallTransformation</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Add the folling line to your gradle file :</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">ext['groovy.version'] = '2.5.6' //i.e your grovy version.</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<br />
Another issues with java 11<br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> Unable to load class groovy.xml.jaxb.Jaxb GroovyMethods due to missing dependency javax/xml/bind/JAXBContext </span><br />
<br />
You can fix this by adding the following dependency on the latest groovy version<br />
<br />
<!-- your section of the post that is going to be displayed on the main page goes here -->
<span class="fullpost">
<!---Your Hidden post goes here -->
</span></div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-55671107488736714472019-02-06T07:14:00.000-08:002020-04-20T13:34:04.393-07:00Useful Unix Commands<div dir="ltr" style="text-align: left;" trbidi="on">
1. Count number of lines on all the files in the current folder<br />
<div>
wc -l *<br />
<!-- your section of the post that is going to be displayed on the main page goes here -->
<span class="fullpost">
<!---Your Hidden post goes here -->
</span><br />
<div>
2. Count the number of files on the current directory :</div>
<div>
<div>
ls | wc -l</div>
</div>
<div>
3. Print all the line containing word/s in a file<br />
grep -iw "search words" arc.log</div>
</div>
<div>
4. Thread dumping for a process<br />
<span style="background-color: white; color: #122b45; font-family: Arial, sans-serif; font-size: 12.48px;"> jcmd 8308 JFR.start duration=100s filename=tempo.jfr</span></div>
</div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-72176922214631564662018-12-19T12:08:00.001-08:002018-12-19T12:08:05.048-08:00Simple hack to Update System Properties and Environment variables on Window !<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<span style="background-color: white;"><span style="color: #242729; font-family: Arial, Helvetica Neue, Helvetica, sans-serif;"><span style="font-size: 15px;">If you don't have a permission to edit the System variable on your local window machine, the following hack might work</span></span></span></div>
<span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;"><div>
<span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;"><br /></span></div>
Click Window and type "SystemPropertiesAdvanced" on Search programs and file search text option. Then, once you see the </span><span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;">SystemPropertiesAdvanced </span><span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;">shortcut, right click it and open it as an administrator. You might be able to edit it now.<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmjWXUdnEmTfLEp3eVe9c0epT1QhaylhrViJdByUJMkFK6pzBg4wDzBXrv61IdfJVDg9DQnkd8rQUjH371aKHji-UJjQCcX-Y7kD2uvdXUwpgUYVy_HBhpqDqWF30C3cQRk8oRb3NqItI/s1600/SystemPropertiesAdvanced.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="617" data-original-width="503" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmjWXUdnEmTfLEp3eVe9c0epT1QhaylhrViJdByUJMkFK6pzBg4wDzBXrv61IdfJVDg9DQnkd8rQUjH371aKHji-UJjQCcX-Y7kD2uvdXUwpgUYVy_HBhpqDqWF30C3cQRk8oRb3NqItI/s320/SystemPropertiesAdvanced.png" width="260" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
</span><!-- your section of the post that is going to be displayed on the main page goes here -->
<span class="fullpost">
<!---Your Hidden post goes here -->
</span><br />
<div>
<span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;"><br /></span></div>
<div>
<span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;"><br /></span></div>
</div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-28258037960332669852018-04-13T18:17:00.000-07:002018-04-13T18:17:30.727-07:00MySql Query to turn ON Query statistics I/O<div dir="ltr" style="text-align: left;" trbidi="on">
<PRE>
SET STATISTICS IO ON
SET STATISTICS TIME ON
SELECT er.ReportID, er.ReportName, er.ReportNumber
FROM dbo.EmployeeReports er
WHERE er.ReportNumber LIKE '%33%'
SET STATISTICS IO OFF
SET STATISTICS TIME OFF
</PRE>
<!-- your section of the post that is going to be displayed on the main page goes here -->
<span class="fullpost">
<!---Your Hidden post goes here -->
</span></div>Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-29703457406379680812018-04-13T18:04:00.001-07:002018-04-13T18:11:01.610-07:00MySQL Nested Case SQL statements (CASE WHEN OR THEN ELSE END )<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Following is an example of nested MySQL Case When or then else End statement.</b>
<code>
</code><br />
<div dir="ltr" style="text-align: left;" trbidi="on">
<pre>select
CASE
When (table.field1 = '01')
THEN
CASE
When (SUBSTRING_INDEX(table.field1, ' ', 1) = 'abc')
THEN '01abc'
ELSE 'abc'
END
WHEN (table.field1 = '02')
THEN
CASE
When ((SUBSTRING_INDEX(table.field1, ' ', 1)) = 'def')
THEN '02def'
ELSE 'def'
END
When (table.field1 = '03')
THEN
CASE
When ((SUBSTRING_INDEX(table.field1, ' ', 1)) = 'efg')
THEN '03efg'
ELSE 'efg'
END
WHEN (table.field1 = '04')
THEN
CASE
When ((SUBSTRING_INDEX(table.field1, ' ', 1)) = 'pqr')
THEN '04pqr'
ELSE 'pqr'
END
END
from table ;
</pre>
<span class="fullpost">
<!---Your Hidden post goes here -->
</span></code></code></div>
</div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-59325510833847582922017-12-19T16:56:00.001-08:002017-12-19T17:37:57.834-08:00Is this the beginning of the end of BitCoin, Etherum and LiteCoin ? Did it really crashed today evening ??<div dir="ltr" style="text-align: left;" trbidi="on">
The BitCoin was traded at $14,212 at 6:40 PM CST, December 19 2017. The price is almost 27% less than its highest value. At the time of the post of this blog, the BitCoin is now backed up to $17,149
<br />
<br />
The Etherum was traded at $705 at 6:40 PM CST, December 19 2017. The price is almost 17% less than its highest value. At the time of the post of this blog, the Etherum is now backed up to $772
The<br />
<br />
LiteCoin was traded at $277 at 6:40 PM CST, December 19 2017. The price is almost 37% less than its highest value of $371. At the time of the post of this blog, the LiteCoin is now backed up to $320
<br />
<br />
Where as the Bitcoin Cash is enjoying a ride of $3100 per bitcoin cash which is almost 41% higher than its yesterday's price.
<span class="fullpost">
<!---Your Hidden post goes here -->
</span></div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-74895875769554763542017-08-30T08:23:00.001-07:002018-01-21T12:13:50.801-08:00Fix for xcrun: error: invalid active developer path after updating your mac OS to Sierra<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- your section of the post that is going to be displayed on the main page goes here -->
If you are geting the following error with Git or any other tools while running it on from your terminal<br />
<span style="font-family: Courier New, Courier, monospace;">xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun. </span><br />
<br />
using the following command to fix it<br />
<span style="font-family: Courier New, Courier, monospace;">xcode-select --install</span></div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-72221887897779530132017-03-03T09:39:00.001-08:002021-02-02T06:09:55.879-08:00Git Cheat Sheet<div dir="ltr" style="text-align: left;" trbidi="on">
<b>A. To List your local branchs :</b><br />
<ul style="text-align: left;">
<li><span style="font-family: "courier new" , "courier" , monospace;"> git branch</span></li>
</ul>
<br />
<b>B. How to get or fetch a remote Branch </b><br />
<b> </b>You first need to fetch and check out the remote branc<br />
<ul style="text-align: left;">
<li> <span style="font-family: "courier new" , "courier" , monospace;">git fetch remote remote_branch_name (eg : git fetch origin story2525/mytest_remote_branch)</span></li>
<li><span style="font-family: "courier new" , "courier" , monospace;">git checkout remote_branch_name</span></li>
</ul>
<b> </b><br />
<br />
<b>C. How to delete a Branch both locally and remotely: </b><br />
<br />
1. Delete the remote branch <br />
<ul style="text-align: left;">
<li><span style="font-family: "courier new" , "courier" , monospace;"> git push origin :branch_name or </span></li>
<li><span style="font-family: "courier new" , "courier" , monospace;"> git push origin --delete branch_name</span></li>
</ul>
<br />
2. Delete a local branch <br />
<ul style="text-align: left;">
<li><span style="font-family: "courier new" , "courier" , monospace;"> git branch -d branch_name <span style="font-family: "georgia" , "times new roman" , serif;">(use <span style="font-family: "courier new" , "courier" , monospace;">-D</span> if your branch hasn't been fully merge yet)</span></span><span style="font-family: "georgia" , "times new roman" , serif;"> </span> </li>
</ul>
<br />
<b>D. How to rename your remote Branch : </b><br />
<br />
1. Rename branch locally <br />
<ul style="text-align: left;">
<li><span style="font-family: "courier new" , "courier" , monospace;"> git branch -m old_branch new_branch </span> </li>
</ul>
<br />
2. Delete the old remote branch <br />
<ul style="text-align: left;">
<li><span style="font-family: "courier new" , "courier" , monospace;"> git push origin :old_branch</span> </li>
</ul>
<br />
3. Push the new Branch and update the upstream to point it to the new remote branch. <br />
<ul style="text-align: left;">
<li><span style="font-family: "courier new" , "courier" , monospace;"> git push --set-upstream origin new_branch</span></li>
</ul>
<div>
<span face=""arial" , "helvetica" , sans-serif">E.</span><span style="font-family: "courier new" , "courier" , monospace;"> </span><span face=""arial" , "helvetica" , sans-serif">Git Logs :</span></div>
<div>
<div style="color: #454545; font-size: 12px; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="color: #454545; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">git log --oneline | grep searchString</span></div>
<div style="color: #454545; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">git log --pretty=format:"%cn committed %h on %cd"| grep searchString</span></div>
</div>
<br />
F. Force Push :<br />
<div style="color: #454545; font-size: 12px; font-stretch: normal; line-height: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> git push origin refactor/mybranch —force</span></div>
<br />
G: Change the remote<br />
<div class="MsoNormal" style="font-family: Calibri, sans-serif; font-size: 12pt; margin: 0in 0in 0.0001pt;">
<span style="font-size: 11pt;">git remote set-url origin <<your remote="" repo="" url="">><o:p></o:p></your></span><br />
<span style="font-size: 11pt;"><your remote="" repo="" url=""><br /></your></span>
<span style="font-size: 11pt;"><your remote="" repo="" url=""><br /></your></span>
<span style="font-size: 11pt;"><your remote="" repo="" url=""><b>H. Ammend message for a committed and pushed changes</b></your></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0.0001pt;">
<span style="font-family: "courier new" , "courier" , monospace;"> git commit --amend </span><br />
<span face=""calibri" , sans-serif">To push the changes to the branch (myBranch) on the remote repository (origin) use: </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git push --force-with-lease origin myBranch</span></div>
<br />
<span face=""calibri" , sans-serif" style="font-size: 11pt;"><br /></span><span face=""calibri" , sans-serif" style="font-size: 16px;"></span><span face=""calibri" , sans-serif" style="font-size: 11pt;"><your remote="" repo="" url=""><b>H. Reset your branch to origin version, revert all your local commit and changes.</b></your></span><br />
<span face=""calibri" , sans-serif" style="font-size: 11pt;"><your remote="" repo="" url=""><b>Plese stash your changes before you do it. git stash</b></your></span><br />
<span face=""calibri" , sans-serif" style="font-size: 11pt;"><your remote="" repo="" url=""></your></span><br />
<pre style="background-color: #eff0f1; border: 0px; box-sizing: inherit; color: #242729; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;"><code style="border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;">git reset --hard origin/yourbranch</code></pre>
<span face=""calibri" , sans-serif" style="font-size: 11pt;"><your remote="" repo="" url=""><b><br /></b></your></span>
<br />
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;"><b> I. undo the last commit and unstage all the files:</b></span></span><br />
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;"><br /></span></span>
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;">git reset HEAD~;</span></span><br />
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;"><b><br /></b></span></span>
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;"><b>j. Undo the commit and completely remove all changes(Becareful !)</b></span></span><br />
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;"><b><br /></b></span></span>
<span style="font-size: 14.6667px;"><b><span face=""calibri" , sans-serif"></span></b></span><br />
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;">git reset --hard HEAD~;</span></span><br />
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;"><br /></span></span>
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;"><b>K. Undo previous merge:</b></span></span><br />
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;">check the previous log :</span></span><br />
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;">git log</span></span><br />
<span face=""calibri" , sans-serif"><span style="font-size: 14.6667px;">Then revert back the merge corresponding to the commit hash</span></span><br />
<span face="calibri, sans-serif"><span face="calibri, sans-serif" style="font-size: 14.6667px;"> git revert -m 1 <mergecommithash></mergecommithash></span></span><br />
<span face="calibri, sans-serif"><span face="calibri, sans-serif" style="font-size: 14.6667px;">And finally push your changes:</span></span><br />
<span face="calibri, sans-serif"><span face="calibri, sans-serif" style="font-size: 14.6667px;">git push</span></span></div><div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-size: 14.6667px;"><b><br /></b></span></div><div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-size: 14.6667px;"><b>L. Roll Back your git push</b></span></div><div dir="ltr" style="text-align: left;" trbidi="on"><pre style="border-radius: 5px; border: 0px; box-sizing: inherit; color: var(--highlight-color); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: 1.30769; margin-bottom: calc(var(--s-prose-spacing) + 0.4em); margin-top: 0px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 12px; vertical-align: baseline; width: auto;"><code style="border-radius: 0px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;">git push -f origin last_good_commit_hash:yourbranch</code></pre></div><div dir="ltr" style="text-align: left;" trbidi="on"><p style="text-align: left;"><span style="font-size: 14.6667px;"> example : git push -f origin 4d875f7e3e8:develop</span></p>
<span face="calibri, sans-serif"><span face="calibri, sans-serif" style="font-size: 14.6667px;"><br /></span></span>
<!--your section of the post that is going to be displayed on the main page goes here-->
<span class="fullpost">
<!---Your Hidden post goes here-->
</span></div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-24169552362620488762016-12-18T10:23:00.003-08:002016-12-18T10:23:47.072-08:00How to check if the given string is palindrome (Recursive vs Non-recursive )<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; color: #252525; font-family: sans-serif; font-size: 14px;">A </span><b style="color: #252525; font-family: sans-serif; font-size: 14px;">palindrome</b><span style="background-color: white; color: #252525; font-family: sans-serif; font-size: 14px;"> is a word, phrase, </span><a href="https://en.wikipedia.org/wiki/Palindromic_number" style="background-image: none; color: #0b0080; font-family: sans-serif; font-size: 14px; text-decoration: none;" title="Palindromic number">number</a><span style="background-color: white; color: #252525; font-family: sans-serif; font-size: 14px;">, or other sequence of </span><a href="https://en.wikipedia.org/wiki/Character_(symbol)" style="background-image: none; color: #0b0080; font-family: sans-serif; font-size: 14px; text-decoration: none;" title="Character (symbol)">characters</a><span style="background-color: white; color: #252525; font-family: sans-serif; font-size: 14px;"> which reads the same backward or forward, such as "</span><i style="color: #252525; font-family: sans-serif; font-size: 14px;">level"</i><span style="background-color: white; color: #252525; font-family: sans-serif; font-size: 14px;"> or "</span><i style="color: #252525; font-family: sans-serif; font-size: 14px;">kayak" or </i><span style="background-color: white; color: #252525; font-family: sans-serif; font-size: 14px;"> "amanaplanacanalpanama" </span><!-- your section of the post that is going to be displayed on the main page goes here -->
<span class="fullpost">
<!---Your Hidden post goes here -->
</span><br />
<div>
<span style="background-color: white; color: #252525; font-family: sans-serif; font-size: 14px;"><br /></span></div>
<div>
<span style="background-color: white; color: #242729; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px;">Following is the program to check if the given string is a palindrome. </span></div>
<div>
<span style="background-color: white; color: #242729; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px;"><br /></span></div>
<div>
<span style="background-color: white; color: #242729; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px;"><br /></span></div>
<div>
<span style="background-color: white; color: #242729; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px;"><br /></span></div>
<div>
<pre style="background-color: white; font-family: Menlo; font-size: 9pt;"><span style="color: navy; font-weight: bold;">package </span>com.mytech.today;
<span style="color: navy; font-weight: bold;">public class </span>PalindromeClient {
<span style="color: navy; font-weight: bold;">public static boolean </span>isPalendrome (String s) {
<span style="color: navy; font-weight: bold;">if</span>(s== <span style="color: navy; font-weight: bold;">null</span>) {
<span style="color: navy; font-weight: bold;">throw new </span>RuntimeException(<span style="color: green; font-weight: bold;">"null value passed"</span>);
}
<span style="color: navy; font-weight: bold;">int </span>n = s.length();
<span style="color: navy; font-weight: bold;">if</span>(n==<span style="color: blue;">1</span>) <span style="color: navy; font-weight: bold;">return true</span>;
<span style="color: navy; font-weight: bold;">else </span>{
<span style="color: navy; font-weight: bold;">for </span>(<span style="color: navy; font-weight: bold;">int </span>i=<span style="color: blue;">0</span>; i < n/<span style="color: blue;">2 </span>; i++) {
<span style="color: navy; font-weight: bold;">if</span>(s.charAt(i)!=s.charAt(n-i-<span style="color: blue;">1</span>)) {
<span style="color: navy; font-weight: bold;">return false</span>;
}
}
}
<span style="color: navy; font-weight: bold;">return true</span>;
}
<span style="color: navy; font-weight: bold;">public static boolean </span>isPalendromeRecurrsive (String s) {
<span style="color: navy; font-weight: bold;">if </span>(s.length()<<span style="color: blue;">2</span>) { <span style="color: navy; font-weight: bold;">return true</span>;}
<span style="color: navy; font-weight: bold;">else if </span>(s.charAt(<span style="color: blue;">0</span>)==s.charAt(s.length()-<span style="color: blue;">1</span>)) {
<span style="color: navy; font-weight: bold;">return </span><span style="font-style: italic;">isPalendrome</span>(s.substring(<span style="color: blue;">1</span>, s.length()-<span style="color: blue;">1</span>));
}
<span style="color: navy; font-weight: bold;">else return false</span>;
}
<span style="color: navy; font-weight: bold;">public static void </span>main(String[] args) {
System.<span style="color: #660e7a; font-style: italic; font-weight: bold;">out</span>.println(<span style="font-style: italic;">isPalendrome</span>(<span style="color: green; font-weight: bold;">"levvel"</span>));
System.<span style="color: #660e7a; font-style: italic; font-weight: bold;">out</span>.println(<span style="font-style: italic;">isPalendrome</span>(<span style="color: green; font-weight: bold;">"</span><span style="color: green; font-size: 9pt; font-weight: bold;">manaplanacanalpanama</span><span style="color: green; font-size: 9pt; font-weight: bold;">"</span><span style="font-size: 9pt;">));</span></pre>
<pre style="background-color: white; font-family: Menlo; font-size: 9pt;"> System.<span style="color: #660e7a; font-style: italic; font-weight: bold;">out</span>.println(<span style="font-style: italic;">isPalendrome</span>(<span style="color: green; font-weight: bold;">"a"</span>));
System.<span style="color: #660e7a; font-style: italic; font-weight: bold;">out</span>.println(<span style="font-style: italic;">isPalendrome</span>(<span style="color: green; font-weight: bold;">"jptt aefa afdaf"</span>));
System.<span style="color: #660e7a; font-style: italic; font-weight: bold;">out</span>.println(<span style="font-style: italic;">isPalendromeRecurrsive</span>(<span style="color: green; font-weight: bold;">"levvel"</span>));
System.<span style="color: #660e7a; font-style: italic; font-weight: bold;">out</span>.println(<span style="font-style: italic;">isPalendromeRecurrsive</span>(<span style="color: green; font-weight: bold;">"</span><span style="color: green; font-size: 9pt; font-weight: bold;">manaplanacanalpanama</span><span style="color: green; font-size: 9pt; font-weight: bold;">"</span><span style="font-size: 9pt;">));</span></pre>
<pre style="background-color: white; font-family: Menlo; font-size: 9pt;"> System.<span style="color: #660e7a; font-style: italic; font-weight: bold;">out</span>.println(<span style="font-style: italic;">isPalendromeRecurrsive</span>(<span style="color: green; font-weight: bold;">"a"</span>));
System.<span style="color: #660e7a; font-style: italic; font-weight: bold;">out</span>.println(<span style="font-style: italic;">isPalendromeRecurrsive</span>(<span style="color: green; font-weight: bold;">"jptt aefa afdaf"</span>));
}
}</pre>
</div>
</div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-79900664661989198932013-06-19T06:15:00.002-07:002013-06-19T06:30:43.279-07:00Replace Line Break and Spaces on Text Area using java script !<div dir="ltr" style="text-align: left;" trbidi="on">
A simple way to replace line break and spaces on a text area content can be done simply by replacing the line break value and the space value with the corresponding html tag as following .<br />
<br />
<code>function replaceLineBreaksAndSpaces(textValue) {<br /> textValue = replaceSpaceCharacter(replaceLineBreak(textValue));<br /> return textValue;<br />}<br /> <br />function replaceLineBreak(textValue) {<br /><br /> textValue = textValue.replace(/\r?\n/g, ' </code><code>
<br /</code><code>>');<br /> return textValue;<br /><br />}<br /><br />function replaceSpaceCharacter(textValue) {<br /><br /> textValue = textValue.replace(/ /g, ' &nbsp;');<br /> return textValue;<br />}</code> <span class="fullpost"><!---Your Hidden post goes here -->
</span></div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-43551283925953109792012-11-16T12:12:00.000-08:002012-11-16T12:24:47.597-08:00Java Script function to Convert your local Date to UTC format Date<div dir="ltr" style="text-align: left;" trbidi="on">
There might be a case that you might need to save date on UTC format while the user input date might be regional date time format. The following function converts the date on the UI layers itself from the input reginonal date to UTC Date. <br />
<br />
<code>function convertToUTCFormat(date){ </code><br />
<code>var year = "" + date.getUTCFullYear();</code><br />
<code>var month = "" + (date.getUTCMonth() + 1);</code><code>if (month.length == 1) { month = "0" + month; } //months range is [0-11] </code><br />
<code>var day = "" + date.getUTCDate(); </code><code>if (day.length == 1) { day = "0" + day; } </code><br />
<code>var hour = "" + date.getUTCHours();</code><code>if (hour.length == 1) { hour = "0" + hour; }</code><br />
<code>var minute = "" + date.getUTCMinutes(); if (minute.length == 1) minute = "0" + minute; } var second = "" + date.getUTCSeconds(); if (second.length == 1) { second = "0" + second; } </code><br />
<br />
<code>return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second+":000"; } </code></div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0tag:blogger.com,1999:blog-4924966385028011361.post-31144132622003936512012-10-02T08:10:00.001-07:002012-10-02T08:16:12.460-07:00java.lang.IllegalStateException: Imbalanced frame stack! (exit() called too many times) !<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- your section of the post that is going to be displayed on the main page goes here -->
If you started using SpringSource Insight,It's highly recommended to increase the memory of the tc Runtime Instance to more than what your application requires on its own . The following is the exception you might see in case there is not enough memory.
<br><b>type</b> Exception report <br>
message <br>
<br><b>description</b><u>The server encountered an internal error () that prevented it from fulfilling this request.</u></bt>
<br><b>exception</b>
<br><code>java.lang.IllegalStateException: Imbalanced frame stack! (exit() called too many times)<br>
com.springsource.insight.intercept.trace.ThreadLocalFrameBuilder.exit(ThreadLocalFrameBuilder.java:61)
<br> com.springsource.insight.collection.DefaultOperationCollector.exit(DefaultOperationCollector.java:111)
<br> com.springsource.insight.collection.DefaultOperationCollector.exitAbnormal(DefaultOperationCollector.java:85)
<br> com.springsource.insight.plugin.annotation.InsightOperationAnnotationCollectionAspect.ajc$afterThrowing$com_springsource_insight_plugin_annotation_InsightOperationAnnotationCollectionAspect$3$5840edd2(InsightOperationAnnotationCollectionAspect.aj:50)
<br> com.concur.midtier.webservices.xmlhttp.servlets.ReqRespMessageListener.service(ReqRespMessageListener.java:165)
<br> javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
</code><br><br>
<b>note</b> <u>The full stack trace of the root cause is available in the VMware vFabric tc Runtime 2.6.2.RELEASE/7.0.22.A.RELEASE logs.</u>
<br><br>
There are few options to resolve this issue.
<span class="fullpost">
<ol> <li>
Increase the max heap <br>
For example: <i>-Xmx512m </i>
<li>or max PermGen size JVM option.<br>
For example: <i> -XX:MaxPermSize=256m</i>
<li>Increase the Spring insight max frame <br>
For example: <i>-Dinsight-max-frames=6000 </i>
</ol>
OR you can have all of the above JVM parameters.
</span></div>
Bishow Paudelhttp://www.blogger.com/profile/13404171528390907420noreply@blogger.com0