<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ayush Goyal on Medium]]></title>
        <description><![CDATA[Stories by Ayush Goyal on Medium]]></description>
        <link>https://medium.com/@goyalayush?source=rss-a74b6c87c4d5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DwAjWqSuJ6HdFkhW-cv9Og.jpeg</url>
            <title>Stories by Ayush Goyal on Medium</title>
            <link>https://medium.com/@goyalayush?source=rss-a74b6c87c4d5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:03:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@goyalayush/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Super safe bash history]]></title>
            <link>https://goyalayush.medium.com/super-safe-bash-history-ec39767d1ea3?source=rss-a74b6c87c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec39767d1ea3</guid>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[system-administration]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[shell]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Ayush Goyal]]></dc:creator>
            <pubDate>Mon, 23 Nov 2020 06:35:48 GMT</pubDate>
            <atom:updated>2020-11-23T14:36:39.702Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>A catastrophe is just a few keystrokes away between that Ctrl-r and Returnon shell.</blockquote><h3>Intro</h3><p>If you are like me, someone who spends a lot of time on the terminal, often ssh’d into a remote server, you start appreciating the power of scrolling through your bash history via Ctrl-r. It saves a ton of time from typing commonly used commands, quite the life saver.</p><p>A few years back though, this nifty workflow ended up biting me in the ass. While scrolling through my command history, I pressed a sequence of keystrokes (by mistake), which ended up executing a DROP TABLEon Mysql. <br>It happened so fast, I didn’t realize what hit me.</p><p>Luckily, it was a non-critical monitoring system, and affected the Grafana dashboard db to be precise. It took a couple of days worth effort, to reconstruct those dashboards. Sure enough, we added the missed mysqldump scripts on that server the next day.</p><p>In aftermath of this incident, I spent some time thinking how to avoid this from happening in future. Lot of sysadmins, rely on their bash history to quickly get stuff done. And no matter how much seasoned touch typing skills you possess, it’s not without some amount of error rate. A catastrophe is just a few keystrokes away between that Ctrl-r and Return on shell. That Murphy’s law ain’t forgiving.</p><h3>Solution</h3><p>Thinking about it, a simple idea came to me. Why not comment all the commands in bash history after each command execution?</p><p>This nifty idea is super simple to implement by adding following lines in your ~/.bash_profile:</p><pre>function make_bash_history_safe() {<br>   history -a  # Save current history in memory to ~/.bash_history<br>   history -c  # Clear current history list in memory</pre><pre>   # Comment all uncommented commands in ~/.bash_history with sed<br>   sed -i -e &#39;s/^\([^#]\)/# \1/g&#39; ~/.bash_history</pre><pre>   history -r  # Reload history in memory from ~/.bash_history file<br>}</pre><pre># Execute make_bash_history_safe after each command execution<br>PROMPT_COMMAND=&quot;make_bash_history_safe; &quot;</pre><p>I am quite sure this wasn’t/isn’t an original idea, I must have copied this snippet from somewhere on stack-overflow. But it has been with me for a while in various incarnations.</p><h3>Result</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XOFxO0cM9AKsmDYSVPb-JQ.gif" /><figcaption>A screencast of safe history after each command execution</figcaption></figure><p>I even keep a simple snippet of make_bash_history_safe, in my snippet manager Dash. In it’s concise form, it looks like this:</p><pre>history -a; history -c; sed -i -e &#39;s/^\([^#]\)/# \1/g&#39;  ~/.bash_history ; history -r;</pre><p>After executing any unsafe command on less commonly ssh’d server, where I don’t maintain ~/.bash_profile, I run the above snippet.</p><h3>Slight Pitfall</h3><p>With this, the bash history is now super safe. However, to execute any command from the history, you will now require to remove the comment character # from the beginning of line. This can get slightly frustrating, but it’s just matter of pressing:</p><pre>&lt;Ctrl-a&gt; ; Go to beginning of line<br>&lt;Ctrl-d&gt; ; Delete first character on line, `#` in this case<br>&lt;Return&gt; ; Run the command</pre><p>I personally prefer delegating this to another function. Did you know, you can modify the currently typed command on bash prompt by modifying READLINE_LINE variable. With following snippet in ~/.bash_profile:</p><pre>function remove_comment() {<br>  READLINE_LINE=`echo ${READLINE_LINE} | sed -E -e &quot;s/^[# ]+//g&quot;`<br>}</pre><pre>bind -x &#39;&quot;\C-x\C-x&quot;: remove_comment&#39;</pre><p>I bind Ctrl-x Ctrl-x(Ctrl-x, pressed twice), to run the remove_comment function. As labeled, it removes any comment character #and any spaces, at the beginning of line of current command in bash prompt. After that, you can execute the command by pressing Return.</p><h3>Outro</h3><p>Being server admins, we are bound to run commands which can have disastrous outcomes when run in wrong environment/directory at wrong time. However minuscule the possibility might be to execute a bad command from history, I personally would err on side of caution, eliminating it using good software-assisted workflows.</p><p>There might be better workflows out there to address the same, let me know in the comments if I am missing out on anything.</p><p>Update 1: You can follow the reddit discussion on <a href="https://www.reddit.com/r/commandline/comments/jzcoyh/super_safe_bash_history/">r/commandline</a>. There are some improvements suggested by u/geirha for BSD and other environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec39767d1ea3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An opinion about having opinions]]></title>
            <link>https://medium.com/helpshift-engineering/an-opinion-about-having-opinions-87829b4155b3?source=rss-a74b6c87c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/87829b4155b3</guid>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[opinion]]></category>
            <dc:creator><![CDATA[Ayush Goyal]]></dc:creator>
            <pubDate>Wed, 29 Jan 2020 08:31:40 GMT</pubDate>
            <atom:updated>2020-01-29T08:31:40.498Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>TL;DR — Having opinionated peers in a software development organization is a great asset. But it’s also important to exercise opinions responsibly. This blog summarizes some ideas on how to be responsible while being opinionated.</blockquote><p>If you are a software engineer, you must have come across people who are considered <em>strongly opinionated</em>. Based on my experience working at Helpshift, I think it’s an important value to have among employees in a tech organization. It can be a constructive, productive force if exercised correctly. People with this trait are often sought after in our industry.</p><p>I can summarize being opinionated and how to exercise it as follows.</p><h3>Being opinionated means having strong preferences</h3><p>When you are opinionated, you have a specific, strong stance on a subject matter. These preferences/stances are usually based on experience and knowledge. Something that has worked for you in past, or something you have read and strongly agree with.</p><h3>Being opinionated allows to make quick decisions</h3><p>Being opinionated can help you move fast in the direction of your preference. The exact direction, right or wrong, good or bad, matters less as nobody has perfect foresight. You can always reconsider your past decision later and change your direction. This can be a great asset to any team or an organization to move fast towards a certain goal.</p><h3>Try avoiding biases when forming your opinions</h3><p>It’s important to form your own personal opinions, avoiding the biases of other people. It’s hard to be completely self-initiated, but doing so even a little will lend a certain amount of authenticity in your opinions.</p><p>This is mostly achieved through personal experience, rather than just reading. Authenticity of your opinions will lend you more credibility and your peers will respect your ideas, finding them more reliable.</p><p>In the light of new information, you might also require to retrospect a strongly held opinion from scratch. This can be hard as it requires avoiding previously acquired biases. But don’t shy away from this effort. Overall, it will make you a better engineer.</p><h3>Be responsible while being opinionated</h3><p>A bit of responsibility is attached to being opinionated. You should be ready to debate for your ideas when faced with opposition. This debate will allow your team to pick the best available solution.</p><p>To debate effectively, your opinion must be rooted in some clear, concrete rationale. It cannot be shallow. This slightly extends over the previous idea. When your opinions are self acquired, they usually have strong reasoning. Responsible opinions are best served well articulated.</p><h3>Be civil while being opinionated</h3><p>You should be civil when presenting or debating your ideas. There is a thin line between being opinionated and forcing your opinion on others. Be mindful that you are not rude in such a situation.</p><h3>Be ready to concede and change your opinions</h3><p>Experience can make you rigid in your opinion. But, it should not make you impervious to new ideas and changing your existing opinions.</p><p>You should be ready to concede your opinion when a better idea is presented for a given problem. Accepting and assimilating ideas different from your own, results in genesis of better solutions.</p><p>Conceding your opinion doesn’t usually mean that your idea itself was wrong. But for a given software problem, there can be multiple solutions and choosing one can be a matter of making the right trade-off at the right time.</p><h3>Respect time, while being opinionated</h3><p>Be mindful of the time you can afford to assert your opinions. You should not end up wasting your time and more importantly your fellow peers’ time while asserting opinions. Yielding your stance to other peoples’ opinion can be a surprisingly good way to make progress.</p><h3>When in doubt, trust your leader</h3><p>This is a slight extension of the previous idea. In the face of disagreement, deferring to your leader’s judgement helps to conclude faster, rather than staying in limbo with indecision.</p><p>It is much faster to start working on a proof of concept based on the decision taken by your leader. If the decided solution doesn’t work out in this initial iterations, you can revisit it with your leader and re-assert your idea. Many a times, however, you will realize that your leader’s decision was the right one. Take advantage of their experience.</p><p>Software development is hard. Requirements keep changing over time. Having opinionated people in the team can help organizations move fast and make good decisions along the way. Exercised in right spirit, being opinionated benefits both the individual and the organization.</p><p>That’s all folks. Any feedback is welcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87829b4155b3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/helpshift-engineering/an-opinion-about-having-opinions-87829b4155b3">An opinion about having opinions</a> was originally published in <a href="https://medium.com/helpshift-engineering">helpshift-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Scyllabackup and Spongeblob]]></title>
            <link>https://medium.com/helpshift-engineering/announcing-scyllabackup-and-spongeblob-c90e8d54abeb?source=rss-a74b6c87c4d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c90e8d54abeb</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[backup]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[scylladb]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Ayush Goyal]]></dc:creator>
            <pubDate>Fri, 14 Sep 2018 07:30:57 GMT</pubDate>
            <atom:updated>2018-09-14T07:30:57.637Z</atom:updated>
            <content:encoded><![CDATA[<p>Production Engineering team at Helpshift strongly believes in standing on the shoulders of giants. We leverage tonnes of open source software on a daily basis. Open Source gives us great momentum to build our platform, and modify software to suit our requirements. Today, we are excited to announce immediate availability of two new shiny projects.</p><p><a href="https://github.com/helpshift/scyllabackup"><strong>Scyllabackup</strong></a> is a cli tool written for taking <a href="https://www.scylladb.com/">ScyllaDB</a> backups. It can take ScyllaDB snapshot and upload it to cloud storage with a single command. It also supports operations to cleanup old snapshots (for data compliance like GDPR and others) and to automate restores.</p><p>Under the hood, Scyllabackup utilizes <a href="https://github.com/helpshift/spongeblob.py"><strong>spongeblob</strong></a>, an interface library for various cloud storages. Currently, spongeblob supports operations for <strong>AWS Simple Storage Service (S3) </strong>and <strong>Microsoft Azure Blob Storage (WABS)</strong>, but is extensible to support other blob storage providers.</p><p>We have ScyllaDB production servers running in both AWS and Azure cloud. Scyllabackup allows us to take frequent backups in the blob storage of each of these cloud platform.</p><p>Both these projects are written in python and are available via PyPI. Source Code is available on <a href="https://github.com/helpshift">github</a>, released under the MIT License.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c90e8d54abeb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/helpshift-engineering/announcing-scyllabackup-and-spongeblob-c90e8d54abeb">Announcing Scyllabackup and Spongeblob</a> was originally published in <a href="https://medium.com/helpshift-engineering">helpshift-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>