<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joseph Violago</title>
    <description>The latest articles on DEV Community by Joseph Violago (@joevdotme).</description>
    <link>https://dev.to/joevdotme</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F753227%2F247764bd-bc6a-435f-83fb-fb0eb8b97f34.jpeg</url>
      <title>DEV Community: Joseph Violago</title>
      <link>https://dev.to/joevdotme</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joevdotme"/>
    <language>en</language>
    <item>
      <title>Bash Tweaks 1: git prompt</title>
      <dc:creator>Joseph Violago</dc:creator>
      <pubDate>Mon, 13 Feb 2023 21:51:39 +0000</pubDate>
      <link>https://dev.to/joevdotme/bash-tweaks-1-git-prompt-20om</link>
      <guid>https://dev.to/joevdotme/bash-tweaks-1-git-prompt-20om</guid>
      <description>&lt;p&gt;Originally posted on &lt;a href="http://blog.joev.me/blog/2013/12/23/Bash-Tweaks-1-git-prompt/"&gt;joev.me&lt;/a&gt; @ 2013-12-23&lt;/p&gt;

&lt;p&gt;I can best describe my work environment in three words – git, bash &amp;amp; tabs. While it is important to have a basic level of competancy in bone-stock environments, I am also a firm believer in optimizing my workspace for the sake of comfort and productivity.&lt;/p&gt;

&lt;p&gt;I mainly do my git fiddlin’ in bash console. Occasionally, I’ll use GitHub for investigating blames &amp;amp; history crawling. But my exposure &amp;amp; increased competence in git cli has taught me to appreciate a spruced up git config. Tour of my git toolbelt after the break.&lt;/p&gt;

&lt;p&gt;Though bash is the core example of minimalist HUD (and simple is güd), I definately feel that a plain command prompt is too bare to productively manipulate &amp;amp; traverse branches.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;I don’t know where I am (locally) compared to origin.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This problem really presents itself if/when my local &lt;code&gt;HEAD&lt;/code&gt; has diverged from a merge conflict, working on out-of-date branches, or if a collaborator likes to push right before I do. (I’m looking at you, &lt;del&gt;Montero&lt;/del&gt; (ﾉಥ益ಥ）ﾉ﻿ ┻━┻)&lt;/p&gt;

&lt;p&gt;Solution(s)?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Option 1: &lt;strong&gt;$&lt;/strong&gt; &lt;code&gt;git status&lt;/code&gt; my fingers numb (yeowch!)&lt;/li&gt;
&lt;li&gt;Option 2: Configure a hotkey in &lt;code&gt;.inputrc&lt;/code&gt; (more on that later…)&lt;/li&gt;
&lt;li&gt;Option 3: Setup &lt;code&gt;.bashrc&lt;/code&gt; to always show a mini &lt;code&gt;git status&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are some limitations to each though:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Excessive typing; finger fatigue…&lt;/li&gt;
&lt;li&gt;Commands are now mapped to a hardware-specific input, which may not work when remoting in from another machine.&lt;/li&gt;
&lt;li&gt;Some basic knowledge in shell scripting is required.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Today, Option 3.&lt;/p&gt;




&lt;h2&gt;
  
  
  Dependencies
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install git&lt;/li&gt;
&lt;li&gt;Verify files or get them.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/usr/lib/git-core/git-sh-prompt&lt;/code&gt; &lt;a href="https://github.com/git/git/blob/master/contrib/completion/git-completion.bash"&gt;github&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/usr/share/bash-completion/completions/git&lt;/code&gt; &lt;a href="https://github.com/git/git/blob/master/contrib/completion/git-completion.bash"&gt;github&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If you see below, you’re good:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;/etc/bash_completion.d/git-prompt&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# In git versions &amp;lt; 1.7.12, this shell library was part of the&lt;/span&gt;
&lt;span class="c"&gt;# git completion script.&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# Some users rely on the __git_ps1 function becoming available&lt;/span&gt;
&lt;span class="c"&gt;# when bash-completion is loaded.  Continue to load this library&lt;/span&gt;
&lt;span class="c"&gt;# at bash-completion startup for now, to ease the transition to a&lt;/span&gt;
&lt;span class="c"&gt;# world order where the prompt function is requested separately.&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="nb"&gt;.&lt;/span&gt; /usr/lib/git-core/git-sh-prompt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Setup bashrc
&lt;/h2&gt;

&lt;p&gt;Copy into &lt;code&gt;~/.bashrc&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Setup git autocompletion&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /usr/share/bash-completion/completions/git &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="nb"&gt;.&lt;/span&gt; /usr/share/bash-completion/completions/git
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c"&gt;# Setup git PS1 integration&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /usr/lib/git-core/git-sh-prompt &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nb"&gt;.&lt;/span&gt; /usr/lib/git-core/git-sh-prompt
&lt;span class="k"&gt;fi

&lt;/span&gt;GIT_PS1_SHOWCOLORHINTS      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"true"&lt;/span&gt;
GIT_PS1_SHOWUPSTREAM        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"verbose count git"&lt;/span&gt;
GIT_PS1_SHOWSTASHSTATE      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;
GIT_PS1_SHOWDIRTYSTATE      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;
GIT_PS1_SHOWUNTRACKEDFILES  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;

&lt;span class="c"&gt;# Uncomment one of these&lt;/span&gt;
&lt;span class="c"&gt;# no-color&lt;/span&gt;
&lt;span class="c"&gt;# PS1='\u@\h:\w\n\d [\T]\n$(__git_ps1)\$ '&lt;/span&gt;
&lt;span class="c"&gt;# color&lt;/span&gt;
&lt;span class="c"&gt;# PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\n\[\033[00m\]\d [\T]\n\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ '&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apply changes to current terminal session:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;$&lt;/strong&gt; &lt;code&gt;. ~/.bashrc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your bash prompt should now look like either of these:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  user@host:/home/user/git-path
    Mon Dec 23 &lt;span class="o"&gt;[&lt;/span&gt;12:21:43]
    &lt;span class="o"&gt;(&lt;/span&gt;master &lt;span class="nv"&gt;u&lt;/span&gt;&lt;span class="o"&gt;=)&lt;/span&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;_

    user@host:/home/user/git-path
    Mon Dec 23 &lt;span class="o"&gt;[&lt;/span&gt;12:21:43]
    &lt;span class="o"&gt;(&lt;/span&gt;master &lt;span class="nv"&gt;u&lt;/span&gt;&lt;span class="o"&gt;=)&lt;/span&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;_
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And fin. Gone are the days of:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;what branch am I on in this window?&lt;/em&gt;&lt;br&gt;
&lt;em&gt;(slam out more &lt;code&gt;git status&lt;/code&gt;)&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But kidding aside, this addition to my prompt has significantly cut down my frequency in calling &lt;code&gt;git status&lt;/code&gt;. It is totally worth the minimal effort to implement.&lt;/p&gt;




&lt;h2&gt;
  
  
  Explained
&lt;/h2&gt;

&lt;p&gt;That &lt;code&gt;PS1&lt;/code&gt; looks pretty cryptic, eh? Most of the script is mainly shell script. You can read more about tweaking bash prompt here. The secret sauce (and purpose of this post) is &lt;code&gt;$(__git_ps1)&lt;/code&gt;, which comes from &lt;code&gt;/usr/lib/git-core/git-sh-prompt&lt;/code&gt;. If you’re itchy to customize, I invite you to read into the file to learn all about &lt;code&gt;git_ps1&lt;/code&gt;’s different settings.&lt;/p&gt;

&lt;p&gt;Written with &lt;a href="https://stackedit.io/"&gt;StackEdit&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>bash</category>
      <category>git</category>
    </item>
    <item>
      <title>Octopress Plugins: s3_website</title>
      <dc:creator>Joseph Violago</dc:creator>
      <pubDate>Mon, 13 Feb 2023 21:38:44 +0000</pubDate>
      <link>https://dev.to/joevdotme/octopress-plugins-s3website-142f</link>
      <guid>https://dev.to/joevdotme/octopress-plugins-s3website-142f</guid>
      <description>&lt;p&gt;Originally posted on &lt;a href="http://blog.joev.me/blog/2013/11/25/Octopress-Plugins-s3-website/"&gt;joev.me&lt;/a&gt; @ 2013-11-25&lt;/p&gt;

&lt;p&gt;I’m hosted on S3 thanks to &lt;a href="http://www.robertbrewitz.com/2013/04/relaunching-the-blog-with-octopress-and-amazon-s3/"&gt;this blog post&lt;/a&gt; by Robert Brewitz. Do take a moment to read his post. My first swing at setup took me about a day to wrap my head around. After the next couple tries/tests, plugging-in &lt;code&gt;jeckyl-s3&lt;/code&gt; felt just as easy to slap together as octopress.&lt;/p&gt;

&lt;p&gt;While browsing the &lt;code&gt;jekyll-s3&lt;/code&gt; repo, I found out that the project moved here. So I redid my octopress setup from scratch – which took &amp;lt; 5 min anyways (^_^). Upgrade impressions &amp;amp; comparisons after the break.&lt;/p&gt;

&lt;p&gt;Luckily, Robert Brewitz’ tutorial was still mostly valid. So the config on &lt;code&gt;_config.yml&lt;/code&gt; and s3 config did not need re-configuration. Huge time saver. Where the tutorial started to fall short where parts calling &lt;code&gt;s3-jeckyl&lt;/code&gt; (obviously). The &lt;code&gt;s3_website&lt;/code&gt; command is a bit different from jeckyl-s3, but there’s sufficient info in the README.md for you to figure it out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Was it worth the upgrade?
&lt;/h2&gt;

&lt;p&gt;Yes. Apart from more documentation, &amp;amp; logical commands, &lt;code&gt;s3_website&lt;/code&gt; has also included (or, at least, made more apparent) additional features (routing, ). Overall, in the 7 months’ time that Robert Brewitz blogged about s3-jeckyl, the plugin/gem/watevs has evolved much more; into a well-packaged product.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Don’t suck at s3 bucket nomenclature.&lt;/p&gt;

&lt;p&gt;The only reason why I had as much trouble configuring &lt;code&gt;jeckyl-s3&lt;/code&gt; in the first place was because I was so stubborn in my desired routing. Don’t be stubborn. Follow the damn tute and be merry. ‘Nuff said.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kinda wish I read a tutorial like &lt;a href="http://mycowsworld.com/blog/2013/08/04/setting-up-octopress-with-amazon-web-services/"&gt;this&lt;/a&gt; prior. (read: &lt;a href="http://www.investopedia.com/terms/d/duediligence.asp"&gt;dd&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add &lt;code&gt;_site&lt;/code&gt; to &lt;code&gt;.gitignore&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Do this for the same reason why &lt;code&gt;public&lt;/code&gt; is in &lt;code&gt;.gitignore&lt;/code&gt; – it’s generated markup, typically not intended to be edited.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Changing destination in &lt;code&gt;_config.yml&lt;/code&gt; will break &lt;code&gt;rake preview&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This was fun… it took me months to realize this. I’m a noob at ruby. So now i keep destination stored like below and toggle the comment when pushing. Brilliant! &lt;em&gt;pats self on back&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;...&lt;/span&gt;
&lt;span class="na"&gt;destination&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;public&lt;/span&gt;   &lt;span class="c1"&gt;# default; rake preview&lt;/span&gt;
&lt;span class="c1"&gt;# destination: _site  # s3_website push&lt;/span&gt;
&lt;span class="nn"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Welp, I hope this serves you well in your development of a slick deployment process. This was a good icebreaker exercise to get acquainted with octopress &amp;amp; jeckyl. I’ve been cruising on this high of slick tweaking and have been doing some work in the asides. But more on that later.&lt;/p&gt;

&lt;p&gt;Written with &lt;a href="https://stackedit.io/"&gt;StackEdit&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>octopress</category>
      <category>s3</category>
    </item>
  </channel>
</rss>
