<?xml version="1.0" encoding="utf-8"?>

<feed xmlns="http://www.w3.org/2005/Atom">
<title>Tyler Cipriani: pages tagged shell</title>
<link href="https://tylercipriani.com/tags/shell/"/>
<link href="https://tylercipriani.com/tags/shell/index.atom" rel="self" type="application/atom+xml"/>
<author>

<name>Tyler Cipriani</name>

</author>




<id>https://tylercipriani.com/tags/shell/</id>

<subtitle type="html">Tyler Cipriani</subtitle>
<generator uri="http://ikiwiki.info/">ikiwiki</generator>
<updated>2017-07-01T00:49:09Z</updated>
<entry>
	<title>Bash Completion</title>

	<id>https://tylercipriani.com/blog/2016/08/30/bash-completion/</id>

	<link href="https://tylercipriani.com/blog/2016/08/30/bash-completion/"/>

	<author><name>Tyler Cipriani</name></author>


	<rights type="html" xml:lang="en">

		&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;
		Copyright © 2017 Tyler Cipriani

	</rights>



	<category term="bash" />

	<category term="computing" />

	<category term="notes" />

	<category term="shell" />


	<updated>2017-07-01T00:49:09Z</updated>
	<published>2016-08-30T05:01:47Z</published>


	<content type="html" xml:lang="en">
	&lt;section id=&quot;links&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Links &lt;a href=&quot;https://tylercipriani.com/tags/shell/#links&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1&quot;&gt;Intro to bash completion&lt;/a&gt;&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;basics&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Basics &lt;a href=&quot;https://tylercipriani.com/tags/shell/#basics&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Most Debian installed bash completions live under &lt;code&gt;/usr/share/bash_completion/completions&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb1&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;co&quot;&gt;# the first argument ($1) is the name of the command whose  arguments are being completed&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;co&quot;&gt;# the second argument ($2) is the word being completed,&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;co&quot;&gt;# and the third argument ($3) is the word preceding the word  being  completed  on the current command line&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;co&quot;&gt;# In the context of this function the following variables are defined:&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;co&quot;&gt;# COMP_LINE, COMP_POINT, COMP_KEY, and COMP_TYPE&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-6&quot; title=&quot;6&quot;&gt;&lt;span class=&quot;co&quot;&gt;# as well as COMP_WORDS and COMP_CWORD&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;co&quot;&gt;#  It must put the possible completions in the COMPREPLY array&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-8&quot; title=&quot;8&quot;&gt;&lt;span class=&quot;co&quot;&gt;# See bash(1) &amp;#39;^  Programmable Completion&amp;#39; for more information&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-9&quot; title=&quot;9&quot;&gt;&lt;span class=&quot;fu&quot;&gt;_some_function()&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-10&quot; title=&quot;10&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;cur&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;cmd&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-11&quot; title=&quot;11&quot;&gt;  &lt;span class=&quot;va&quot;&gt;cur=${COMP_WORDS[$COMP_CWORD]}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-12&quot; title=&quot;12&quot;&gt;  &lt;span class=&quot;va&quot;&gt;cmd=(&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;${COMP_WORDS[@]}&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-14&quot; title=&quot;14&quot;&gt;&lt;span class=&quot;bu&quot;&gt;complete&lt;/span&gt; -F _some_function command&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;complete-options&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;&lt;code&gt;complete&lt;/code&gt; options &lt;a href=&quot;https://tylercipriani.com/tags/shell/#complete-options&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some complete options you want:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-o bashdefault&lt;/code&gt; - if no completions are found do the bash default thing&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-o default&lt;/code&gt; - readline completions if both the complete function and bash expansions fail&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-o nospace&lt;/code&gt; - don’t append a space at the end of matches (useful if you’re doing directory stuffs)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-S or -P&lt;/code&gt; - a prefix or suffix that is added at the end of a completion generated by the function passed to &lt;code&gt;complete -F&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section id=&quot;example&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Example &lt;a href=&quot;https://tylercipriani.com/tags/shell/#example&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb2&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Many of the ideas presented in this script were stolen&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;co&quot;&gt;# in-part or wholesale from&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;co&quot;&gt;# &amp;lt;https://github.com/git/git/blob/master/contrib/completion/git-completion.bash&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;va&quot;&gt;__scap_subcommands=&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;fu&quot;&gt;__scap_get_subcommands()&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-6&quot; title=&quot;6&quot;&gt;    &lt;span class=&quot;kw&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;bu&quot;&gt; [&lt;/span&gt; &lt;span class=&quot;ot&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$__scap_subcommands&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;bu&quot;&gt; ]&lt;/span&gt;; &lt;span class=&quot;kw&quot;&gt;then&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-7&quot; title=&quot;7&quot;&gt;        &lt;span class=&quot;bu&quot;&gt;return&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-8&quot; title=&quot;8&quot;&gt;    &lt;span class=&quot;kw&quot;&gt;fi&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-9&quot; title=&quot;9&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-10&quot; title=&quot;10&quot;&gt;    &lt;span class=&quot;va&quot;&gt;__scap_subcommands=$(&lt;/span&gt;&lt;span class=&quot;ex&quot;&gt;scap&lt;/span&gt; --_autocomplete&lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-11&quot; title=&quot;11&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-12&quot; title=&quot;12&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;fu&quot;&gt;_scap()&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-14&quot; title=&quot;14&quot;&gt;    &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;cur&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;cmd=()&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;sub&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;rep&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-15&quot; title=&quot;15&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-16&quot; title=&quot;16&quot;&gt;    &lt;span class=&quot;va&quot;&gt;cur=${COMP_WORDS[$COMP_CWORD]}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-17&quot; title=&quot;17&quot;&gt;    &lt;span class=&quot;va&quot;&gt;cmd=(&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;${COMP_WORDS[@]}&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-18&quot; title=&quot;18&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-19&quot; title=&quot;19&quot;&gt;    &lt;span class=&quot;kw&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;((&lt;/span&gt; COMP_CWORD == 1 &lt;span class=&quot;kw&quot;&gt;))&lt;/span&gt;; &lt;span class=&quot;kw&quot;&gt;then&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-20&quot; title=&quot;20&quot;&gt;        &lt;span class=&quot;ex&quot;&gt;__scap_get_subcommands&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-21&quot; title=&quot;21&quot;&gt;        &lt;span class=&quot;va&quot;&gt;rep=$(&lt;/span&gt; &lt;span class=&quot;bu&quot;&gt;compgen&lt;/span&gt; -W &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$__scap_subcommands&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; -- &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$cur&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-22&quot; title=&quot;22&quot;&gt;        &lt;span class=&quot;va&quot;&gt;COMPREPLY=(&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$rep&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-23&quot; title=&quot;23&quot;&gt;        &lt;span class=&quot;bu&quot;&gt;return&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-24&quot; title=&quot;24&quot;&gt;    &lt;span class=&quot;kw&quot;&gt;fi&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-25&quot; title=&quot;25&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-26&quot; title=&quot;26&quot;&gt;    &lt;span class=&quot;co&quot;&gt;# limit the command to autocomplete to the first 3 words&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-27&quot; title=&quot;27&quot;&gt;    &lt;span class=&quot;kw&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;((&lt;/span&gt; COMP_CWORD &amp;gt;= 2 &lt;span class=&quot;kw&quot;&gt;))&lt;/span&gt;; &lt;span class=&quot;kw&quot;&gt;then&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-28&quot; title=&quot;28&quot;&gt;        &lt;span class=&quot;co&quot;&gt;# don&amp;#39;t complete any sub-subcommands, only options&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-29&quot; title=&quot;29&quot;&gt;        &lt;span class=&quot;kw&quot;&gt;if [[&lt;/span&gt; &lt;span class=&quot;ot&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$cur&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &amp;amp;&amp;amp; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;${cur:0:1}&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;ot&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;-&amp;#39;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt; ]]&lt;/span&gt;; &lt;span class=&quot;kw&quot;&gt;then&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-30&quot; title=&quot;30&quot;&gt;            &lt;span class=&quot;va&quot;&gt;COMPREPLY=()&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-31&quot; title=&quot;31&quot;&gt;            &lt;span class=&quot;bu&quot;&gt;return&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-32&quot; title=&quot;32&quot;&gt;        &lt;span class=&quot;kw&quot;&gt;fi&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-33&quot; title=&quot;33&quot;&gt;        &lt;span class=&quot;va&quot;&gt;cmd=(&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;${COMP_WORDS[@]:0:3}&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-34&quot; title=&quot;34&quot;&gt;    &lt;span class=&quot;kw&quot;&gt;fi&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-35&quot; title=&quot;35&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-36&quot; title=&quot;36&quot;&gt;    &lt;span class=&quot;co&quot;&gt;# replace the last word in the command with &amp;#39;--_autocomplete&amp;#39;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-37&quot; title=&quot;37&quot;&gt;    &lt;span class=&quot;va&quot;&gt;cmd[ $((&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;${#cmd[@]}&lt;/span&gt; - 1 &lt;span class=&quot;va&quot;&gt;)) ]=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;#39;--_autocomplete&amp;#39;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-38&quot; title=&quot;38&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-39&quot; title=&quot;39&quot;&gt;    &lt;span class=&quot;va&quot;&gt;rep=$(&lt;/span&gt; &lt;span class=&quot;bu&quot;&gt;compgen&lt;/span&gt; -W &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$(&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;${cmd[@]}&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; -- &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$cur&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-40&quot; title=&quot;40&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-41&quot; title=&quot;41&quot;&gt;    &lt;span class=&quot;va&quot;&gt;COMPREPLY=(&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$rep&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-42&quot; title=&quot;42&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-43&quot; title=&quot;43&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-44&quot; title=&quot;44&quot;&gt;&lt;span class=&quot;co&quot;&gt;# By default append nospace except when completion comes from _scap&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-45&quot; title=&quot;45&quot;&gt;&lt;span class=&quot;bu&quot;&gt;complete&lt;/span&gt; -S&lt;span class=&quot;st&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt; -o bashdefault -o default -o nospace -F _scap scap&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;

	</content>


	<link rel="comments" href="//tylercipriani.com/blog/2016/08/30/bash-completion/#comments" type="text/html" />


	<link rel="comments" href="//tylercipriani.com/blog/2016/08/30/bash-completion/comments.atom" type="application/atom+xml" />

</entry>
<entry>
	<title>Command-Timing-Bash-Prompt</title>

	<id>https://tylercipriani.com/blog/2016/01/19/Command-Timing-Bash-Prompt/</id>

	<link href="https://tylercipriani.com/blog/2016/01/19/Command-Timing-Bash-Prompt/"/>

	<author><name>Tyler Cipriani</name></author>


	<rights type="html" xml:lang="en">

		&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;
		Copyright © 2017 Tyler Cipriani

	</rights>



	<category term="computing" />

	<category term="shell" />


	<updated>2017-07-01T00:49:09Z</updated>
	<published>2016-01-19T00:00:00Z</published>


	<content type="html" xml:lang="en">
	&lt;p&gt;A few years ago I was using ZSH with Sindre Sorhus’s &lt;a href=&quot;https://github.com/sindresorhus/pure&quot;&gt;Pure prompt&lt;/a&gt; and generally enjoying the experience. The big, dumb, obvious caveat of using ZSH is that it’s not Bash. As a result, when you SSH into production machines that only have bash installed, you feel a little off-balance. &lt;em&gt;Off-balance&lt;/em&gt; is not a feeling you want during an emergency on a live application server. As a result, I switched back to using bash everywhere.&lt;/p&gt;
&lt;section id=&quot;how-i-learned-to-stop-worrying-and-love-bash.&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;How I learned to stop worrying and love bash. &lt;a href=&quot;https://tylercipriani.com/tags/shell/#how-i-learned-to-stop-worrying-and-love-bash.&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I never really missed fancy syntax highlighting, or the nice globbing features, or most of ZSH really. The one thing I missed immensely was not so much a feature of ZSH as it was a feature of the Pure prompt I had been using: execution time for long-running commands shown in the prompt.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;time(1)&lt;/code&gt; command is a command that I never think to run until it’s too late. &lt;a href=&quot;https://github.com/sindresorhus/pure/blob/master/pure.zsh#L46-L53&quot;&gt;The Pure prompt is fancy&lt;/a&gt;. By default, if a particular command takes longer than 5 seconds to run, Pure calculates the running time of that command, and renders a human-readable version just above your current prompt.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb1&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;~&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-2&quot; title=&quot;2&quot;&gt;❯ &lt;span class=&quot;fu&quot;&gt;sleep&lt;/span&gt; 5&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-3&quot; title=&quot;3&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;ex&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;5s&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-5&quot; title=&quot;5&quot;&gt;❯ &lt;span class=&quot;fu&quot;&gt;sleep&lt;/span&gt; 10&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-6&quot; title=&quot;6&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;ex&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;10s&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-8&quot; title=&quot;8&quot;&gt;❯&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;bash-it-until-it-works&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Bash it until it works &lt;a href=&quot;https://tylercipriani.com/tags/shell/#bash-it-until-it-works&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Command execution time in Pure uses the &lt;code&gt;preexec&lt;/code&gt; and &lt;code&gt;precmd&lt;/code&gt; feature of ZSH, which doesn’t exist in Bash. Instead Bash has the less intuitive &lt;code&gt;trap&lt;/code&gt; command and the &lt;code&gt;PROMPT_COMMAND&lt;/code&gt; shell variable.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;PROMPT_COMMAND&lt;/code&gt; is a variable that can be set in your bash config file that, “is executed as a command prior to issuing each primary prompt.” [bash(1)]&lt;/p&gt;
&lt;p&gt;&lt;code&gt;trap [-lp] [arg] [sigspec]&lt;/code&gt; can be used to listen for the &lt;code&gt;DEBUG&lt;/code&gt; signal. “If a sigspec is DEBUG, the command arg is executed before every simple command”&lt;/p&gt;
&lt;p&gt;Using these two tools in conjunction, you can approximate &lt;code&gt;preexec&lt;/code&gt; and &lt;code&gt;precmd&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb2&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;fu&quot;&gt;debug()&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-2&quot; title=&quot;2&quot;&gt;    &lt;span class=&quot;co&quot;&gt;# do nothing if completing&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-3&quot; title=&quot;3&quot;&gt;    [ &lt;span class=&quot;ex&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$COMP_LINE&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; ] &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;bu&quot;&gt;return&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-4&quot; title=&quot;4&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-5&quot; title=&quot;5&quot;&gt;    &lt;span class=&quot;co&quot;&gt;# don&amp;#39;t cause a preexec for $PROMPT_COMMAND&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-6&quot; title=&quot;6&quot;&gt;    [ &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$BASH_COMMAND&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; = &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$PROMPT_COMMAND&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; ] &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;bu&quot;&gt;return&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-7&quot; title=&quot;7&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-8&quot; title=&quot;8&quot;&gt;    &lt;span class=&quot;bu&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;debug&amp;#39;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-9&quot; title=&quot;9&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-10&quot; title=&quot;10&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-11&quot; title=&quot;11&quot;&gt;&lt;span class=&quot;fu&quot;&gt;prompt()&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-12&quot; title=&quot;12&quot;&gt;    &lt;span class=&quot;bu&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;prompt&amp;#39;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-14&quot; title=&quot;14&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;bu&quot;&gt;trap&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;debug&amp;#39;&lt;/span&gt; DEBUG&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-16&quot; title=&quot;16&quot;&gt;&lt;span class=&quot;va&quot;&gt;PROMPT_COMMAND=&lt;/span&gt;prompt&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So now debug is executed before each “simple command” and &lt;code&gt;prompt&lt;/code&gt; is executed before each issuing the primary prompt.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb3&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-1&quot; title=&quot;1&quot;&gt;$ &lt;span class=&quot;bu&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;hi&amp;#39;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;ex&quot;&gt;debug&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;ex&quot;&gt;hi&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;ex&quot;&gt;prompt&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Timing each command is then pretty trivial:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb4&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;fu&quot;&gt;debug()&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-2&quot; title=&quot;2&quot;&gt;    &lt;span class=&quot;co&quot;&gt;# do nothing if completing&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-3&quot; title=&quot;3&quot;&gt;    [ &lt;span class=&quot;ex&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$COMP_LINE&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; ] &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;bu&quot;&gt;return&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-4&quot; title=&quot;4&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-5&quot; title=&quot;5&quot;&gt;    &lt;span class=&quot;co&quot;&gt;# don&amp;#39;t cause a preexec for $PROMPT_COMMAND&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-6&quot; title=&quot;6&quot;&gt;    [ &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$BASH_COMMAND&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; = &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$PROMPT_COMMAND&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; ] &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;bu&quot;&gt;return&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-7&quot; title=&quot;7&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-8&quot; title=&quot;8&quot;&gt;    &lt;span class=&quot;va&quot;&gt;start_time=$(&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;date&lt;/span&gt; +&lt;span class=&quot;st&quot;&gt;&amp;#39;%s&amp;#39;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-9&quot; title=&quot;9&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-10&quot; title=&quot;10&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-11&quot; title=&quot;11&quot;&gt;&lt;span class=&quot;fu&quot;&gt;prompt()&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-12&quot; title=&quot;12&quot;&gt;    &lt;span class=&quot;va&quot;&gt;end_time=$(&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;date&lt;/span&gt; +&lt;span class=&quot;st&quot;&gt;&amp;#39;%s&amp;#39;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-13&quot; title=&quot;13&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-14&quot; title=&quot;14&quot;&gt;    &lt;span class=&quot;bu&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$((&lt;/span&gt; end_time - start_time &lt;span class=&quot;va&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; seconds&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-16&quot; title=&quot;16&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-17&quot; title=&quot;17&quot;&gt;&lt;span class=&quot;bu&quot;&gt;trap&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;debug&amp;#39;&lt;/span&gt; DEBUG&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-18&quot; title=&quot;18&quot;&gt;&lt;span class=&quot;va&quot;&gt;PROMPT_COMMAND=&lt;/span&gt;prompt&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb5&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-1&quot; title=&quot;1&quot;&gt;$ &lt;span class=&quot;fu&quot;&gt;sleep&lt;/span&gt; 2&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;ex&quot;&gt;2&lt;/span&gt; seconds&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-3&quot; title=&quot;3&quot;&gt;$&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Integrating that into the prompt and making it look pretty is just a little-bit of code away:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb6&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Human readable time output&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;co&quot;&gt;# e.g., 5d 6h 3m 2s&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;fu&quot;&gt;format_time()&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-4&quot; title=&quot;4&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;_time=$1&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-5&quot; title=&quot;5&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-6&quot; title=&quot;6&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# Don&amp;#39;t show anything if time is less than 5 seconds&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-7&quot; title=&quot;7&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;((&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$_time&lt;/span&gt; &amp;lt; 5 &lt;span class=&quot;kw&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;bu&quot;&gt;return&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-8&quot; title=&quot;8&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-9&quot; title=&quot;9&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;_out&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-10&quot; title=&quot;10&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;days=$((&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$_time&lt;/span&gt; / 60 / 60 / 24 &lt;span class=&quot;va&quot;&gt;))&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-11&quot; title=&quot;11&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;hours=$((&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$_time&lt;/span&gt; / 60 / 60 % 24 &lt;span class=&quot;va&quot;&gt;))&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-12&quot; title=&quot;12&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;minutes=$((&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$_time&lt;/span&gt; / 60 % 60 &lt;span class=&quot;va&quot;&gt;))&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-13&quot; title=&quot;13&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;seconds=$((&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$_time&lt;/span&gt; % 60 &lt;span class=&quot;va&quot;&gt;))&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-14&quot; title=&quot;14&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;((&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$days&lt;/span&gt; &amp;gt; 0 &lt;span class=&quot;kw&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;_out=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;${days}&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;d&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-15&quot; title=&quot;15&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;((&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$hours&lt;/span&gt; &amp;gt; 0 &lt;span class=&quot;kw&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;_out=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$_out&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;${hours}&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;h&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-16&quot; title=&quot;16&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;((&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$minutes&lt;/span&gt; &amp;gt; 0 &lt;span class=&quot;kw&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;_out=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$_out&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;${minutes}&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;m&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-17&quot; title=&quot;17&quot;&gt;  &lt;span class=&quot;va&quot;&gt;_out=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$_out&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;${seconds}&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;s&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-18&quot; title=&quot;18&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;printf&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$_out&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-19&quot; title=&quot;19&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-20&quot; title=&quot;20&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-21&quot; title=&quot;21&quot;&gt;&lt;span class=&quot;fu&quot;&gt;debug()&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-22&quot; title=&quot;22&quot;&gt;    &lt;span class=&quot;co&quot;&gt;# do nothing if completing&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-23&quot; title=&quot;23&quot;&gt;    [ &lt;span class=&quot;ex&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$COMP_LINE&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; ] &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;bu&quot;&gt;return&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-24&quot; title=&quot;24&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-25&quot; title=&quot;25&quot;&gt;    &lt;span class=&quot;co&quot;&gt;# don&amp;#39;t cause a preexec for $PROMPT_COMMAND&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-26&quot; title=&quot;26&quot;&gt;    [ &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$BASH_COMMAND&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; = &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$PROMPT_COMMAND&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; ] &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;bu&quot;&gt;return&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-27&quot; title=&quot;27&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-28&quot; title=&quot;28&quot;&gt;    &lt;span class=&quot;va&quot;&gt;start_time=$(&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;date&lt;/span&gt; +&lt;span class=&quot;st&quot;&gt;&amp;#39;%s&amp;#39;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-29&quot; title=&quot;29&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-30&quot; title=&quot;30&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-31&quot; title=&quot;31&quot;&gt;&lt;span class=&quot;fu&quot;&gt;prompt()&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-32&quot; title=&quot;32&quot;&gt;    &lt;span class=&quot;va&quot;&gt;end_time=$(&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;date&lt;/span&gt; +&lt;span class=&quot;st&quot;&gt;&amp;#39;%s&amp;#39;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-33&quot; title=&quot;33&quot;&gt;    &lt;span class=&quot;va&quot;&gt;time_f=$(&lt;/span&gt;&lt;span class=&quot;ex&quot;&gt;format_time&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$((&lt;/span&gt; end_time - start_time &lt;span class=&quot;va&quot;&gt;)))&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-34&quot; title=&quot;34&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-35&quot; title=&quot;35&quot;&gt;    &lt;span class=&quot;va&quot;&gt;PS1=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;${time_f}&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; (•◡•)❥&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-36&quot; title=&quot;36&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-37&quot; title=&quot;37&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-38&quot; title=&quot;38&quot;&gt;&lt;span class=&quot;bu&quot;&gt;trap&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;debug&amp;#39;&lt;/span&gt; DEBUG&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-39&quot; title=&quot;39&quot;&gt;&lt;span class=&quot;va&quot;&gt;PROMPT_COMMAND=&lt;/span&gt;prompt&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb7&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-1&quot; title=&quot;1&quot;&gt; &lt;span class=&quot;kw&quot;&gt;(&lt;/span&gt;•◡•&lt;span class=&quot;kw&quot;&gt;)&lt;/span&gt;❥ &lt;span class=&quot;fu&quot;&gt;sleep&lt;/span&gt; 5&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;ex&quot;&gt;5s&lt;/span&gt; (•◡•)❥&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Motherfucking magic.&lt;/p&gt;
&lt;/section&gt;

	</content>


	<link rel="comments" href="//tylercipriani.com/blog/2016/01/19/Command-Timing-Bash-Prompt/#comments" type="text/html" />


	<link rel="comments" href="//tylercipriani.com/blog/2016/01/19/Command-Timing-Bash-Prompt/comments.atom" type="application/atom+xml" />

</entry>
<entry>
	<title>Development Environments with Vagrant, Docker, and Supervisord</title>

	<id>https://tylercipriani.com/blog/2014/05/25/lightweight-portable-vagrant-docker/</id>

	<link href="https://tylercipriani.com/blog/2014/05/25/lightweight-portable-vagrant-docker/"/>

	<author><name>Tyler Cipriani</name></author>


	<rights type="html" xml:lang="en">

		&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;
		Copyright © 2017 Tyler Cipriani

	</rights>



	<category term="computing" />

	<category term="docker" />

	<category term="shell" />

	<category term="vagrant" />


	<updated>2017-07-01T00:49:09Z</updated>
	<published>2014-05-25T00:00:00Z</published>


	<content type="html" xml:lang="en">
	&lt;p&gt;I’ve used Vagrant a fair amount in my day, and it’s great. I enjoy being able to spin-up toy linux environments to test out ideas. I tend to use the &lt;a href=&quot;http://docs.vagrantup.com/v2/provisioning/chef_solo.html&quot;&gt;Chef provisioner&lt;/a&gt; with Vagrant to build-out a local environment that matches my server fairly closely.&lt;/p&gt;
&lt;section id=&quot;my-ever-evolving-rant-about-devops&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;My Ever-Evolving Rant About DevOps &lt;a href=&quot;https://tylercipriani.com/tags/shell/#my-ever-evolving-rant-about-devops&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I’ve been thinking about Chef a lot lately. Often is the time, in moments of profound frustration, that I’ve had the thought that Chef is nothing more than a useless, leaky abstraction that separates me from something I know fairly well—Linux.&lt;/p&gt;
&lt;p&gt;This thought is usually fleeting: Chef provides many needed abstractions that are, ultimately, much easier to grok than the underlying Linux system. Further, Chef allows you to keep a(n ostensibly) well-tested system under version control.&lt;/p&gt;
&lt;p&gt;I’ve come to the realization that my problem with Chef is not really a problem with Chef, but a &lt;a href=&quot;https://www.domenkozar.com/2014/03/11/why-puppet-chef-ansible-arent-good-enough-and-we-can-do-better/&quot;&gt;problem with Linux itself&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Linux system administration is difficult because Linux commands are non-deterministic and rely heavily on system state (e.g., installed software, permissions, network settings and availability). Maintaining a bare-metal, long-running server non-interactively using Chef sucks because &lt;a href=&quot;http://me.andering.com/2011/02/03/server-login-considered-harmful/&quot;&gt;any hand-tinkering via ssh&lt;/a&gt; is going to fuck with the “state” of the system—creating different results for subsequent chef-client runs. This system state adjustment may or may not be reflected in the chef repository (which double sucks).&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;why-docker-curtails-my-rage&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Why Docker Curtails My Rage &lt;a href=&quot;https://tylercipriani.com/tags/shell/#why-docker-curtails-my-rage&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I started to think about Docker. I feel Docker addresses the problem of program state better than other currently available solutions (although, &lt;a href=&quot;https://nixos.org/nixos/&quot;&gt;Nix&lt;/a&gt; is looking pretty promising as well). While Docker is still a Linux system—and, ipso facto, state-dependant—it’s also ephemeral and therefore, by not persisting changes to state, Docker has created a previously unavailable (on bare metal hardware), lightweight workaround to the problem of system state.&lt;/p&gt;
&lt;p&gt;As is my wont, I decided today to play a bit with Docker on Vagrant and, lo-and-below, I found that the newest version of Vagrant (1.6.2, as of May 26th) can actually use &lt;a href=&quot;https://www.vagrantup.com/blog/feature-preview-vagrant-1-6-docker-dev-environments.html&quot;&gt;docker as a &lt;em&gt;provider&lt;/em&gt;&lt;/a&gt;, that is, as an alternative to VirtualBox. Using Docker as a provider means that you can run a fully-independent development enviroment, on your host machine without the overhead of VirtualBox. Neat.&lt;/p&gt;
&lt;p&gt;“Imma setup a local development environment for Ubuntu 14.04, nginx and php-fpm using Vagrant, Supervisord and Docker,” says I.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;project-layout&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Project Layout &lt;a href=&quot;https://tylercipriani.com/tags/shell/#project-layout&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To keep my project directory nice and tidy, I’ve separated-out most of the files needed by the Docker provider into a &lt;code&gt;Docker&lt;/code&gt; folder. This results in the directory structure below.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb1&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-1&quot; title=&quot;1&quot;&gt;├── &lt;span class=&quot;ex&quot;&gt;Docker&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-2&quot; title=&quot;2&quot;&gt;│   ├── &lt;span class=&quot;ex&quot;&gt;Dockerfile&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-3&quot; title=&quot;3&quot;&gt;│   ├── &lt;span class=&quot;ex&quot;&gt;nginx&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-4&quot; title=&quot;4&quot;&gt;│   │   └── &lt;span class=&quot;ex&quot;&gt;default&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-5&quot; title=&quot;5&quot;&gt;│   ├── &lt;span class=&quot;ex&quot;&gt;php-fpm&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-6&quot; title=&quot;6&quot;&gt;│   │   └── &lt;span class=&quot;ex&quot;&gt;php-fpm.conf&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-7&quot; title=&quot;7&quot;&gt;│   └── &lt;span class=&quot;ex&quot;&gt;supervisor&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-8&quot; title=&quot;8&quot;&gt;│       └── &lt;span class=&quot;ex&quot;&gt;supervisord.conf&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-9&quot; title=&quot;9&quot;&gt;├── &lt;span class=&quot;ex&quot;&gt;Vagrantfile&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-10&quot; title=&quot;10&quot;&gt;└── &lt;span class=&quot;ex&quot;&gt;www&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-11&quot; title=&quot;11&quot;&gt;    └── &lt;span class=&quot;ex&quot;&gt;index.php&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;Dockerfile&lt;/code&gt; is used to build the main docker machine and the subfolders in the &lt;code&gt;Docker&lt;/code&gt; directory contain configuration used in the &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;www&lt;/code&gt; folder is my fake php project folder.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;vagrantfile&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;VagrantFile &lt;a href=&quot;https://tylercipriani.com/tags/shell/#vagrantfile&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Since docker handles so much of what was previously handled by Vagrant provisioner, the &lt;code&gt;Vagrantfile&lt;/code&gt; for a Docker-backed Vagrant instance is pretty sparse.&lt;/p&gt;
&lt;p&gt;In mine, I’ve got:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb2&quot;&gt;&lt;pre class=&quot;sourceCode numberSource ruby numberLines&quot;&gt;&lt;code class=&quot;sourceCode ruby&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;dt&quot;&gt;Vagrant&lt;/span&gt;.configure(&lt;span class=&quot;dv&quot;&gt;2&lt;/span&gt;) &lt;span class=&quot;kw&quot;&gt;do&lt;/span&gt; |config|&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-2&quot; title=&quot;2&quot;&gt;  config.vm.synced_folder &lt;span class=&quot;st&quot;&gt;&amp;quot;./www&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st&quot;&gt;&amp;quot;/var/www&amp;quot;&lt;/span&gt;   &lt;span class=&quot;co&quot;&gt;# Sync&amp;#39;d folder&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-3&quot; title=&quot;3&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-4&quot; title=&quot;4&quot;&gt;  config.vm.provider &lt;span class=&quot;st&quot;&gt;&amp;quot;docker&amp;quot;&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;do&lt;/span&gt; |d|&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-5&quot; title=&quot;5&quot;&gt;    d.build_dir = &lt;span class=&quot;st&quot;&gt;&amp;quot;./Docker&amp;quot;&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;# specifies the path to the Dockerfile&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-6&quot; title=&quot;6&quot;&gt;    d.ports &amp;lt;&amp;lt; &lt;span class=&quot;st&quot;&gt;&amp;#39;8080:80&amp;#39;&lt;/span&gt;     &lt;span class=&quot;co&quot;&gt;# Forwards port 8080 from the host to the Docker Container port 80&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-7&quot; title=&quot;7&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;end&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-8&quot; title=&quot;8&quot;&gt;&lt;span class=&quot;kw&quot;&gt;end&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;dockerfile&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Dockerfile &lt;a href=&quot;https://tylercipriani.com/tags/shell/#dockerfile&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Most of the work of provisioning a container is handled by Docker and the Dockerfile. In fact, if you were only ever going to run this container on a Linux machine, I don’t think that Vagrant adds any needed functionality to the &lt;code&gt;docker.io&lt;/code&gt; cli. In terms of portability, however, Vagrant is, at this time, a necessary evil to run docker on OSX and Windows.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb3&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;FROM&lt;/span&gt; ubuntu:latest&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-2&quot; title=&quot;2&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;ex&quot;&gt;MAINTAINER&lt;/span&gt; Tyler Cipriani, tyler@tylercipriani.com&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-4&quot; title=&quot;4&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Download and install php, nginx, and supervisor, hey, just linux for a change!&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-6&quot; title=&quot;6&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; apt-get update&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; apt-get install -y software-properties-common&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-8&quot; title=&quot;8&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; add-apt-repository ppa:nginx/stable&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-9&quot; title=&quot;9&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; apt-get update&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-10&quot; title=&quot;10&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; apt-get -y dist-upgrade&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-11&quot; title=&quot;11&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; apt-get install -y php5-fpm nginx supervisor&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-12&quot; title=&quot;12&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Setup config files&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-14&quot; title=&quot;14&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; echo &lt;span class=&quot;st&quot;&gt;&amp;quot;daemon off;&amp;quot;&lt;/span&gt; &lt;span class=&quot;op&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /etc/nginx/nginx.conf&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;ex&quot;&gt;ADD&lt;/span&gt; ./nginx/default /etc/nginx/sites-enabled/default&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-16&quot; title=&quot;16&quot;&gt;&lt;span class=&quot;ex&quot;&gt;ADD&lt;/span&gt; ./supervisor/supervisord.conf /etc/supervisor/supervisord.conf&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-17&quot; title=&quot;17&quot;&gt;&lt;span class=&quot;ex&quot;&gt;ADD&lt;/span&gt; ./php-fpm/php-fpm.conf /etc/php5/fpm/php-fpm.conf&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-18&quot; title=&quot;18&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-19&quot; title=&quot;19&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Shared volume&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-20&quot; title=&quot;20&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; mkdir -p /var/www&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-21&quot; title=&quot;21&quot;&gt;&lt;span class=&quot;ex&quot;&gt;VOLUME&lt;/span&gt; [&lt;span class=&quot;st&quot;&gt;&amp;quot;/var/www&amp;quot;&lt;/span&gt;]&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-22&quot; title=&quot;22&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-23&quot; title=&quot;23&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Default command for container, start supervisor&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-24&quot; title=&quot;24&quot;&gt;&lt;span class=&quot;ex&quot;&gt;CMD&lt;/span&gt; [&lt;span class=&quot;st&quot;&gt;&amp;quot;supervisord&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st&quot;&gt;&amp;quot;--nodaemon&amp;quot;&lt;/span&gt;]&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-25&quot; title=&quot;25&quot;&gt;&lt;span class=&quot;ex&quot;&gt;USER&lt;/span&gt; root&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-26&quot; title=&quot;26&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-27&quot; title=&quot;27&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Expose port 80 of the container&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-28&quot; title=&quot;28&quot;&gt;&lt;span class=&quot;ex&quot;&gt;EXPOSE&lt;/span&gt; 80&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This &lt;code&gt;Dockerfile&lt;/code&gt; takes care of building a docker container from the latest Ubuntu image (14.04 as of May 26th, 2014). Running this code installs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nginx 1.6.0&lt;/li&gt;
&lt;li&gt;PHP 5.5.9&lt;/li&gt;
&lt;li&gt;Supervisor&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This config also starts supervisor with the &lt;code&gt;--nodaemon&lt;/code&gt; flag by default. Docker can run a container running a non-daemonized program as a daemon (much like supervisor can run non-daemonized programs as daemons). Supervisor is used as a way of running both nginx and php-fpm as non-daemonized programs. It is also noteworthy that the dockerfile creates and/or modifies configuration files for php-fpm and nginx to make sure they both run in non-daemon mode.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;nginx/default&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb4&quot;&gt;&lt;pre class=&quot;sourceCode numberSource numberLines&quot;&gt;&lt;code class=&quot;sourceCode&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-1&quot; title=&quot;1&quot;&gt;server {&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-2&quot; title=&quot;2&quot;&gt;  listen 80 default_server;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-3&quot; title=&quot;3&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-4&quot; title=&quot;4&quot;&gt;  root  /var/www;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-5&quot; title=&quot;5&quot;&gt;  index index.php index.html;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-6&quot; title=&quot;6&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-7&quot; title=&quot;7&quot;&gt;  # pass the PHP scripts to FastCGI server&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-8&quot; title=&quot;8&quot;&gt;  location ~ \.php$ {&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-9&quot; title=&quot;9&quot;&gt;    try_files $uri =404;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-10&quot; title=&quot;10&quot;&gt;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-11&quot; title=&quot;11&quot;&gt;    fastcgi_pass unix:/var/run/php5-fpm.sock;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-12&quot; title=&quot;12&quot;&gt;    fastcgi_index index.php;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-13&quot; title=&quot;13&quot;&gt;    include fastcgi_params;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-14&quot; title=&quot;14&quot;&gt;  }&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-15&quot; title=&quot;15&quot;&gt;}&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;php-fpm/php-fpm.conf&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb5&quot;&gt;&lt;pre class=&quot;sourceCode numberSource ini numberLines&quot;&gt;&lt;code class=&quot;sourceCode ini&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[global]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;dt&quot;&gt;pid &lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; /var/run/php5-fpm.pid&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;dt&quot;&gt;error_log &lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; /var/log/php5-fpm.log&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;dt&quot;&gt;daemonize &lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;no&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-5&quot; title=&quot;5&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-6&quot; title=&quot;6&quot;&gt;&lt;span class=&quot;dt&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/etc/php5/fpm/pool.d/*.conf&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;supervisor/supervisord.conf&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb6&quot;&gt;&lt;pre class=&quot;sourceCode numberSource ini numberLines&quot;&gt;&lt;code class=&quot;sourceCode ini&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[unix_http_server]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;dt&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/var/run/supervisor.sock   ; (the path to the socket file)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;dt&quot;&gt;chmod&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;0700&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;                       ; sockef file mode (&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;0700&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-4&quot; title=&quot;4&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[supervisord]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-6&quot; title=&quot;6&quot;&gt;&lt;span class=&quot;dt&quot;&gt;logfile&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/tmp/supervisord.log ; (main log file;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; $CWD/supervisord.log)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;dt&quot;&gt;logfile_maxbytes&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;50MB        ; (max main logfile bytes b4 rotation;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; 50MB)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-8&quot; title=&quot;8&quot;&gt;&lt;span class=&quot;dt&quot;&gt;logfile_backups&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;           ; (num of main logfile rotation backups;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-9&quot; title=&quot;9&quot;&gt;&lt;span class=&quot;dt&quot;&gt;loglevel&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;info                ; (log level;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; info; others: debug,warn,trace)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-10&quot; title=&quot;10&quot;&gt;&lt;span class=&quot;dt&quot;&gt;pidfile&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/tmp/supervisord.pid ; (supervisord pidfile;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; supervisord.pid)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-11&quot; title=&quot;11&quot;&gt;&lt;span class=&quot;dt&quot;&gt;nodaemon&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;               ; (start in foreground if &lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-12&quot; title=&quot;12&quot;&gt;&lt;span class=&quot;dt&quot;&gt;minfds&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;                  ; (min. avail startup file descriptors;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;dt&quot;&gt;minprocs&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;                 ; (min. avail process descriptors;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-14&quot; title=&quot;14&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;co&quot;&gt;; the below section must remain in the config file for RPC&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-16&quot; title=&quot;16&quot;&gt;&lt;span class=&quot;co&quot;&gt;; (supervisorctl/web interface) to work, additional interfaces may be&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-17&quot; title=&quot;17&quot;&gt;&lt;span class=&quot;co&quot;&gt;; added by defining them in separate rpcinterface: sections&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-18&quot; title=&quot;18&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[rpcinterface:supervisor]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-19&quot; title=&quot;19&quot;&gt;&lt;span class=&quot;dt&quot;&gt;supervisor.rpcinterface_factory &lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; supervisor.rpcinterface:make_main_rpcinterface&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-20&quot; title=&quot;20&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-21&quot; title=&quot;21&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[supervisorctl]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-22&quot; title=&quot;22&quot;&gt;&lt;span class=&quot;dt&quot;&gt;serverurl&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-23&quot; title=&quot;23&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-24&quot; title=&quot;24&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[program:php5-fpm]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-25&quot; title=&quot;25&quot;&gt;&lt;span class=&quot;dt&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/usr/sbin/php5-fpm -c /etc/php5/fpm&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-26&quot; title=&quot;26&quot;&gt;&lt;span class=&quot;dt&quot;&gt;stdout_events_enabled&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;true&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-27&quot; title=&quot;27&quot;&gt;&lt;span class=&quot;dt&quot;&gt;stderr_events_enabled&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;true&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-28&quot; title=&quot;28&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-29&quot; title=&quot;29&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[program:nginx]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-30&quot; title=&quot;30&quot;&gt;&lt;span class=&quot;dt&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/usr/sbin/nginx&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-31&quot; title=&quot;31&quot;&gt;&lt;span class=&quot;dt&quot;&gt;stdout_events_enabled&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;true&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-32&quot; title=&quot;32&quot;&gt;&lt;span class=&quot;dt&quot;&gt;stderr_events_enabled&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;true&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;jam-time&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Jam Time &lt;a href=&quot;https://tylercipriani.com/tags/shell/#jam-time&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;With all of our configuration in place there isn’t much left to do aside from running the vagrant instance and allowing docker to create our container.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb7&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-1&quot; title=&quot;1&quot;&gt;$ &lt;span class=&quot;fu&quot;&gt;sudo&lt;/span&gt; docker pull ubuntu &lt;span class=&quot;co&quot;&gt;# to grab the latest Ubuntu image, Vagrant should probably do this but doesn&amp;#39;t&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-2&quot; title=&quot;2&quot;&gt;$ &lt;span class=&quot;fu&quot;&gt;sudo&lt;/span&gt; vagrant up --provider=docker --debug &lt;span class=&quot;co&quot;&gt;# use debug if you don&amp;#39;t want to sit waiting with no info for a long time on the first run&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With that, you now have a container running nginx and php-fpm that is sharing a folder with you at &lt;code&gt;/var/www&lt;/code&gt;. Navigating to &lt;code&gt;http://localhost:8080/index.php&lt;/code&gt; should show you the contents of your &lt;code&gt;./www/index.php&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;This process is really simple AND super lightweight. I’ve been running my docker/vagrant instance for about 45 minutes alongside chrome and tmux/xterm without any noticeable jankyness on a notoriously janky laptop.&lt;/p&gt;
&lt;/section&gt;

	</content>


	<link rel="comments" href="//tylercipriani.com/blog/2014/05/25/lightweight-portable-vagrant-docker/#comments" type="text/html" />


	<link rel="comments" href="//tylercipriani.com/blog/2014/05/25/lightweight-portable-vagrant-docker/comments.atom" type="application/atom+xml" />

</entry>
<entry>
	<title>Create a Baller/Useful MOTD with ANSI Art</title>

	<id>https://tylercipriani.com/blog/2014/05/22/creating-baller-useful-motd-ascii-art/</id>

	<link href="https://tylercipriani.com/blog/2014/05/22/creating-baller-useful-motd-ascii-art/"/>

	<author><name>Tyler Cipriani</name></author>


	<rights type="html" xml:lang="en">

		&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;
		Copyright © 2017 Tyler Cipriani

	</rights>



	<category term="ansi" />

	<category term="computing" />

	<category term="shell" />


	<updated>2017-07-01T00:49:09Z</updated>
	<published>2014-05-22T00:00:00Z</published>


	<content type="html" xml:lang="en">
	&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: 2017-01-08&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.rzegocki.pl/&quot;&gt;Igor Rzegocki&lt;/a&gt; has a project that uses the same technique outlined here to make some incredible ready-made &lt;a href=&quot;https://github.com/ajgon/street-fighter-motd&quot;&gt;Street FIghter MotDs&lt;/a&gt; – it is really cool, and if you are interested in abusing ansi escape sequences to make MotDs you should check it out :)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;figure&gt;
&lt;img src=&quot;https://tylercipriani-files.s3.amazonaws.com/zangief_motd.png&quot; alt=&quot;Zangief MOtD&quot; /&gt;&lt;figcaption&gt;Zangief MOtD&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Everyone universally agrees that most &lt;a href=&quot;http://linux.die.net/man/5/motd&quot;&gt;Message of the Days (MOTDs)&lt;/a&gt; are stupid and suck. By the end of reading this post, your mind grapes should be swollen with the knowledge of how to make an MOTD that isn’t stupid and, some would say, &lt;em&gt;doesn’t&lt;/em&gt; suck.&lt;/p&gt;
&lt;section id=&quot;prerequisites&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Prerequisites &lt;a href=&quot;https://tylercipriani.com/tags/shell/#prerequisites&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Imagemagick&lt;/li&gt;
&lt;li&gt;OpenJDK&lt;/li&gt;
&lt;li&gt;coreutils&lt;/li&gt;
&lt;li&gt;perl&lt;/li&gt;
&lt;li&gt;git&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This should have you covered:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb1&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-1&quot; title=&quot;1&quot;&gt;$ &lt;span class=&quot;fu&quot;&gt;sudo&lt;/span&gt; apt-get install imagemagick openjdk-6-jdk coreutils perl git&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;creating-the-util-say-file&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Creating the Util-say file &lt;a href=&quot;https://tylercipriani.com/tags/shell/#creating-the-util-say-file&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I use &lt;a href=&quot;https://github.com/maandree/util-say&quot;&gt;Util-Say&lt;/a&gt; to create motd messages. I started out using &lt;a href=&quot;https://github.com/rossy2401/img2xterm&quot;&gt;img2xterm&lt;/a&gt;, but I’ve found I get better results with Util-Say.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb2&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-1&quot; title=&quot;1&quot;&gt;$ &lt;span class=&quot;fu&quot;&gt;git&lt;/span&gt; clone https://github.com/maandree/util-say&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-2&quot; title=&quot;2&quot;&gt;$ &lt;span class=&quot;bu&quot;&gt;cd&lt;/span&gt; util-say&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-3&quot; title=&quot;3&quot;&gt;$ &lt;span class=&quot;ex&quot;&gt;./img2ponysay&lt;/span&gt; -- yourimg.png &lt;span class=&quot;op&quot;&gt;&amp;gt;&lt;/span&gt; yourimg.txt&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can also try &lt;code&gt;./img2ponysay -2 -- youimg.png &amp;gt; yourimg.txt&lt;/code&gt; but I’ve never had good results with that&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;motd-ifying&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;MOTD-ifying &lt;a href=&quot;https://tylercipriani.com/tags/shell/#motd-ifying&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;figure&gt;
&lt;img src=&quot;https://tylercipriani-files.s3.amazonaws.com/mammoth_motd.png&quot; alt=&quot;Mammoth Motd&quot; /&gt;&lt;figcaption&gt;Mammoth Motd&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;On CentOS and Debian, I usually just throw the ponysay file directly into &lt;code&gt;/etc/motd&lt;/code&gt; and maybe add on some other useful info:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb3&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-1&quot; title=&quot;1&quot;&gt;$ &lt;span class=&quot;fu&quot;&gt;sudo&lt;/span&gt; cat yourimg.txt &lt;span class=&quot;op&quot;&gt;&amp;gt;&lt;/span&gt; /etc/motd&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-2&quot; title=&quot;2&quot;&gt;$ &lt;span class=&quot;fu&quot;&gt;sudo&lt;/span&gt; figlet &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;hostname&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;op&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /etc/motd&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-3&quot; title=&quot;3&quot;&gt;$ &lt;span class=&quot;fu&quot;&gt;sudo&lt;/span&gt; printf &lt;span class=&quot;st&quot;&gt;&amp;quot;Public IP: &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;ex&quot;&gt;dig&lt;/span&gt; +short myip.opendns.com @resolver1.opendns.com&lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;\n&amp;quot;&lt;/span&gt; &lt;span class=&quot;op&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /etc/motd&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On Ubuntu Boxes (since they use &lt;a href=&quot;https://wiki.ubuntu.com/UpdateMotd&quot;&gt;update-motd(1)&lt;/a&gt;), I do pretty much the same thing except I just make a bash script in &lt;code&gt;/etc/update-motd.d/25-baller-motd&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb4&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;co&quot;&gt;#!/usr/bin/env bash&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;fu&quot;&gt;cat&lt;/span&gt; yourimg.txt&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;ex&quot;&gt;figlet&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;hostname&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;bu&quot;&gt;printf&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;Public IP: &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;ex&quot;&gt;dig&lt;/span&gt; +short myip.opendns.com @resolver1.opendns.com&lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;\n&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;bu&quot;&gt;command&lt;/span&gt; -v fortune &lt;span class=&quot;op&quot;&gt;&amp;amp;&amp;gt;&lt;/span&gt; /dev/null &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;fortune&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There are likely better articles on creating a &lt;em&gt;useful&lt;/em&gt; MOTD, (&lt;a href=&quot;http://www.mewbies.com/how_to_customize_your_console_login_message_tutorial.htm&quot;&gt;here&lt;/a&gt;’s one that looks kinda cool) but there are exactly none-better articles on creating MOTDs that are so flossy!&lt;/p&gt;
&lt;/section&gt;

	</content>


	<link rel="comments" href="//tylercipriani.com/blog/2014/05/22/creating-baller-useful-motd-ascii-art/#comments" type="text/html" />


	<link rel="comments" href="//tylercipriani.com/blog/2014/05/22/creating-baller-useful-motd-ascii-art/comments.atom" type="application/atom+xml" />

</entry>
<entry>
	<title> Replacing Jekyll with Pandoc and a Makefile</title>

	<id>https://tylercipriani.com/blog/2014/05/13/replace-jekyll-with-pandoc-makefile/</id>

	<link href="https://tylercipriani.com/blog/2014/05/13/replace-jekyll-with-pandoc-makefile/"/>

	<author><name>Tyler Cipriani</name></author>


	<rights type="html" xml:lang="en">

		&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;
		Copyright © 2017 Tyler Cipriani

	</rights>



	<category term="computing" />

	<category term="jekyll" />

	<category term="make" />

	<category term="shell" />


	<updated>2017-07-01T00:49:09Z</updated>
	<published>2014-05-13T00:00:00Z</published>


	<content type="html" xml:lang="en">
	&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: 2016-08-19&lt;/p&gt;
&lt;p&gt;I got an email a very long time ago that I meant to post about on ye old weblog from a fellow named &lt;a href=&quot;http://tomduck.ca/&quot;&gt;Tom Duck&lt;/a&gt; who built a CMS based around some of the ideas presented here.&lt;/p&gt;
&lt;p&gt;It’s called &lt;a href=&quot;https://github.com/tomduck/bassclef/#bassclef-cms&quot;&gt;Bassclef&lt;/a&gt; and it looks pretty amazing and folks should check it out.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I used to use del.icio.us to keep track of links, then it went away. After del.icio.us shutdown, I used a ton of uniquely awful services to keep track of links. Eventually, I came around to the idea that all I needed was a series of markdown files and github: &lt;a href=&quot;https://github.com/thcipriani/links/tree/8d2442d4ba8a9090f645dd2cfe73216a7350dea5&quot;&gt;BOOM!&lt;/a&gt; Public link repositiory—just like del.icio.us back in the day.&lt;/p&gt;
&lt;p&gt;After a while I started thinking, I could make these files a lot more presentable if I did some jekyll-ifying and served them out on github.&lt;/p&gt;
&lt;section id=&quot;previously-jekyllfied&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Previously Jekyllfied &lt;a href=&quot;https://tylercipriani.com/tags/shell/#previously-jekyllfied&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;My &lt;code&gt;linuxtips&lt;/code&gt; repo is just a dumb jekyll repo. Esentially all &lt;code&gt;linuxtips&lt;/code&gt; is is just &lt;a href=&quot;https://github.com/thcipriani/linuxtips/blob/master/README&quot;&gt;a big &lt;code&gt;README&lt;/code&gt; file&lt;/a&gt;. So, for that repo, I created a &lt;code&gt;gh-pages&lt;/code&gt; branch with a &lt;code&gt;_config.yml&lt;/code&gt; and a &lt;code&gt;_layout&lt;/code&gt; directory and popped in a &lt;a href=&quot;https://github.com/thcipriani/linuxtips/blob/gh-pages/Makefile&quot;&gt;Makefile&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb1&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;INDEX&lt;/span&gt; = &lt;span class=&quot;va&quot;&gt;${CURDIR}&lt;/span&gt;/index.md&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-2&quot; title=&quot;2&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;va&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;ex&quot;&gt;INDEX&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;bu&quot;&gt;:&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-4&quot; title=&quot;4&quot;&gt;  &lt;span class=&quot;ex&quot;&gt;@&lt;/span&gt; git show origin/master:README.md &lt;span class=&quot;op&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$@&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-5&quot; title=&quot;5&quot;&gt;  &lt;span class=&quot;ex&quot;&gt;@&lt;/span&gt; perl -i -pe &lt;span class=&quot;st&quot;&gt;&amp;#39;print &amp;quot;---\nlayout: default\ntitle: Linux Tips\n---\n\n&amp;quot; if $$. == 1;&amp;#39;&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;$@&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and then I got &lt;a href=&quot;http://www.tylercipriani.com/linuxtips/&quot;&gt;tylercipriani.com/linuxtips&lt;/a&gt;; neat.&lt;/p&gt;
&lt;p&gt;I ran into some problems with that approach along the way. Mostly problems with git and the separate branches and the order in which I’d commit and pull and whatever, it was/is a headache.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;pandoc&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Pandoc &lt;a href=&quot;https://tylercipriani.com/tags/shell/#pandoc&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I started thinking about &lt;a href=&quot;http://johnmacfarlane.net/pandoc/&quot;&gt;Pandoc&lt;/a&gt;. Pandoc is this haskell library that makes miracles of text happen.&lt;/p&gt;
&lt;p&gt;Got an org-mode file and need TeX? Done.&lt;/p&gt;
&lt;p&gt;Got a markdown slideshow that needs to become a beamer slide show? OK, sure.&lt;/p&gt;
&lt;p&gt;Fuck Beamer, how about markdown slides → Reveal.js slides? You bet your sweet sensual bologna.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;imma-install-pandoc&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Imma install Pandoc… &lt;a href=&quot;https://tylercipriani.com/tags/shell/#imma-install-pandoc&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;/section&gt;
&lt;section id=&quot;debian&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Debian? &lt;a href=&quot;https://tylercipriani.com/tags/shell/#debian&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb2&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;fu&quot;&gt;sudo&lt;/span&gt; apt-get install haskell-platform&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;ex&quot;&gt;cabal&lt;/span&gt; update&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;ex&quot;&gt;cabal&lt;/span&gt; install pandoc&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;then add it to your path in your &lt;code&gt;.${SHELL}rc&lt;/code&gt; file:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb3&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;bu&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;ot&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$HOME&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/.cabal/bin&amp;quot;&lt;/span&gt;&lt;span class=&quot;bu&quot;&gt; ]&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;bu&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;PATH=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$HOME&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/.cabal/bin:&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$PATH&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;osx&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;OSX? &lt;a href=&quot;https://tylercipriani.com/tags/shell/#osx&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb4&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;brew&lt;/span&gt; update&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;ex&quot;&gt;brew&lt;/span&gt; install pandoc&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;imma-use-pandoc&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Imma Use Pandoc… &lt;a href=&quot;https://tylercipriani.com/tags/shell/#imma-use-pandoc&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Alright, so I’ve got tons of markdown files, fairly structured, with bunches of links and I need html5. I’ll create a &lt;code&gt;Makefile&lt;/code&gt; proof-of-concept for this:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb5&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;index.html&lt;/span&gt;: README.md&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-2&quot; title=&quot;2&quot;&gt;  &lt;span class=&quot;ex&quot;&gt;pandoc&lt;/span&gt; -s -f markdown -t html5 -o &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;$&amp;lt;&amp;quot;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Running &lt;code&gt;make&lt;/code&gt; takes my &lt;code&gt;README.md&lt;/code&gt; and makes this:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb6&quot;&gt;&lt;pre class=&quot;sourceCode numberSource html numberLines&quot;&gt;&lt;code class=&quot;sourceCode html&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;dt&quot;&gt;&amp;lt;!DOCTYPE &lt;/span&gt;html&lt;span class=&quot;dt&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-4&quot; title=&quot;4&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;meta&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; charset=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-5&quot; title=&quot;5&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;meta&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; name=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;generator&amp;quot;&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; content=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;pandoc&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-6&quot; title=&quot;6&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;meta&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; name=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;viewport&amp;quot;&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; content=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;width=device-width, initial-scale=1.0, user-scalable=yes&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-7&quot; title=&quot;7&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-8&quot; title=&quot;8&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;style&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; type=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;text/css&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;code{&lt;span class=&quot;kw&quot;&gt;white-space&lt;/span&gt;: &lt;span class=&quot;dv&quot;&gt;pre&lt;/span&gt;&lt;span class=&quot;op&quot;&gt;;&lt;/span&gt;}&lt;span class=&quot;kw&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-9&quot; title=&quot;9&quot;&gt;  &lt;span class=&quot;co&quot;&gt;&amp;lt;!--[if lt IE 9]&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-10&quot; title=&quot;10&quot;&gt;&lt;span class=&quot;co&quot;&gt;    &amp;lt;script src=&amp;quot;http://html5shim.googlecode.com/svn/trunk/html5.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-11&quot; title=&quot;11&quot;&gt;&lt;span class=&quot;co&quot;&gt;  &amp;lt;![endif]--&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-12&quot; title=&quot;12&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-14&quot; title=&quot;14&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;h1&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; id=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;tyler-ciprianis-bookmarks&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;Tyler Cipriani&amp;#39;s Bookmarks&lt;span class=&quot;kw&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;In an effort to &lt;span class=&quot;kw&quot;&gt;&amp;lt;em&amp;gt;&lt;/span&gt;not&lt;span class=&quot;kw&quot;&gt;&amp;lt;/em&amp;gt;&lt;/span&gt; have 100+ tabs open…&lt;span class=&quot;kw&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-16&quot; title=&quot;16&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-17&quot; title=&quot;17&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; href=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;http://www.flickr.com/photos/tylercipriani/&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;My Photography&lt;span class=&quot;kw&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-18&quot; title=&quot;18&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; href=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;Design.md&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;Design&lt;span class=&quot;kw&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-19&quot; title=&quot;19&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; href=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;Development.md&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;Development&lt;span class=&quot;kw&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-20&quot; title=&quot;20&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; href=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;Business.md&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;Business&lt;span class=&quot;kw&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-21&quot; title=&quot;21&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; href=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;Fun.md&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;Fun&lt;span class=&quot;kw&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-22&quot; title=&quot;22&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-23&quot; title=&quot;23&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-24&quot; title=&quot;24&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;titlelayoutcss&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Title/Layout/CSS &lt;a href=&quot;https://tylercipriani.com/tags/shell/#titlelayoutcss&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So now that I’m outputting html, I still need to be able to:&lt;/p&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;Configure a layout in which to render html&lt;/li&gt;
&lt;li&gt;Include a css file in said layout&lt;/li&gt;
&lt;li&gt;Add post metadata to my layout (e.g., title, headline, etc.)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Pandoc is able to do all of these things—easy-peasy-lemon-squeezy.&lt;/p&gt;
&lt;p&gt;First, to establish a layout, let’s copy the default html5 layout file for Pandoc:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb7&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;pandoc&lt;/span&gt; -D html5 &lt;span class=&quot;op&quot;&gt;&amp;gt;&lt;/span&gt; _layout.html5&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I’ll make some small tweaks to that file, keep the variables I need, ditch the variables I don’t need. Here is the html5 layout file I came up with:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb8&quot;&gt;&lt;pre class=&quot;sourceCode numberSource html numberLines&quot;&gt;&lt;code class=&quot;sourceCode html&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;dt&quot;&gt;&amp;lt;!doctype &lt;/span&gt;html&lt;span class=&quot;dt&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;html&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; lang=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;en&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-4&quot; title=&quot;4&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;meta&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; charset=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-5&quot; title=&quot;5&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;meta&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; http-equiv=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;X-UA-Compatible&amp;quot;&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; content=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;IE=edge&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-6&quot; title=&quot;6&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$&lt;span class=&quot;kw&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-7&quot; title=&quot;7&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;meta&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; name=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;viewport&amp;quot;&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; content=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;width=device-width, initial-scale=1&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-8&quot; title=&quot;8&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;link&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; rel=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;stylesheet&amp;quot;&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; href=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;http://fonts.googleapis.com/css?family=Open+Sans:800&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-9&quot; title=&quot;9&quot;&gt;$for(css)$&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-10&quot; title=&quot;10&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;link&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; rel=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;stylesheet&amp;quot;&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; href=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;$css$&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-11&quot; title=&quot;11&quot;&gt;$endfor$&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-12&quot; title=&quot;12&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-14&quot; title=&quot;14&quot;&gt;  &lt;span class=&quot;co&quot;&gt;&amp;lt;!--[if lt IE 9]&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;co&quot;&gt;    &amp;lt;script src=&amp;quot;http://html5shim.googlecode.com/svn/trunk/html5.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-16&quot; title=&quot;16&quot;&gt;&lt;span class=&quot;co&quot;&gt;  &amp;lt;![endif]--&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-17&quot; title=&quot;17&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-18&quot; title=&quot;18&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;main&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt; class=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;container&amp;quot;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-19&quot; title=&quot;19&quot;&gt;    $body$&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-20&quot; title=&quot;20&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-21&quot; title=&quot;21&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-22&quot; title=&quot;22&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-23&quot; title=&quot;23&quot;&gt;&lt;span class=&quot;kw&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next, I need to figure out how to include a css stylesheet. A quick search for &lt;code&gt;css&lt;/code&gt; in &lt;code&gt;pandoc(1)&lt;/code&gt; turns up the &lt;code&gt;--css&lt;/code&gt; flag which enables you to link to a css stylesheet.&lt;/p&gt;
&lt;p&gt;Updated &lt;code&gt;Makefile&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb9&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;index.html&lt;/span&gt;: README.md&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-2&quot; title=&quot;2&quot;&gt;  &lt;span class=&quot;ex&quot;&gt;pandoc&lt;/span&gt; -s --template &lt;span class=&quot;st&quot;&gt;&amp;quot;_layout&amp;quot;&lt;/span&gt; --css &lt;span class=&quot;st&quot;&gt;&amp;quot;css/main.css&amp;quot;&lt;/span&gt; -f markdown -t html5 -o &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;$&amp;lt;&amp;quot;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally, I need to be able to include a unique &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; tag string for each page. Again, a search through &lt;code&gt;pandoc(1)&lt;/code&gt; for &lt;code&gt;variable&lt;/code&gt; yields results; using the &lt;code&gt;-V&lt;/code&gt; flag enables you to set template variables using &lt;code&gt;-V [KEY]=[val]&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;A bit more digging in the online docs, however, nets better solution: YAML Metadata blocks—just like jekyll!&lt;/p&gt;
&lt;p&gt;So, for each markdown file in my repo, I’ll add a block to the top that looks like this:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb10&quot;&gt;&lt;pre class=&quot;sourceCode numberSource yaml numberLines&quot;&gt;&lt;code class=&quot;sourceCode yaml&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb10-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ot&quot;&gt;---&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb10-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;fu&quot;&gt;pagetitle:&lt;/span&gt;&lt;span class=&quot;at&quot;&gt; &amp;lt;pagetitle&amp;gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb10-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;ot&quot;&gt;---&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;$pagetitle$&lt;/code&gt; is the variable I defined in my &lt;code&gt;_layout.html5&lt;/code&gt; that I’m now passing as a template to Pandoc.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;makefile-fanciness&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Makefile fanciness &lt;a href=&quot;https://tylercipriani.com/tags/shell/#makefile-fanciness&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Alright, so now that I have the basics of Pandoc down, I need to whip my &lt;code&gt;Makefile&lt;/code&gt; into shape.&lt;/p&gt;
&lt;p&gt;First thing is I want to convert ALL of my markdown files to html, not just the &lt;code&gt;README.md&lt;/code&gt;. So howzabout I add a wildcard target for all the &lt;code&gt;html&lt;/code&gt; files? Also, the whole point of this is to make a github pages site, so let’s add that to the &lt;code&gt;Makefile&lt;/code&gt; too&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb11&quot;&gt;&lt;pre class=&quot;sourceCode numberSource makefile numberLines&quot;&gt;&lt;code class=&quot;sourceCode makefile&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;dt&quot;&gt;REPO &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;shell&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; git config --get remote.origin.url&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; gh-pages&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-3&quot; title=&quot;3&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;dv&quot;&gt;all:&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;addprefix&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;addsuffix&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; .html&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;wildcard&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; *.md&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;))))&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-5&quot; title=&quot;5&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-6&quot; title=&quot;6&quot;&gt;&lt;span class=&quot;dv&quot;&gt;$(GHPAGES):&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-7&quot; title=&quot;7&quot;&gt;  git clone &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;REPO&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-8&quot; title=&quot;8&quot;&gt;  (cd &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; git checkout &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;) || (cd &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; git checkout --orphan &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; git rm -rf .)&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-9&quot; title=&quot;9&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-10&quot; title=&quot;10&quot;&gt;&lt;span class=&quot;dv&quot;&gt;$(GHPAGES)/%.html:&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; %.md&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-11&quot; title=&quot;11&quot;&gt;  pandoc -s --template &lt;span class=&quot;st&quot;&gt;&amp;quot;_layout&amp;quot;&lt;/span&gt; -c &lt;span class=&quot;st&quot;&gt;&amp;quot;css/main.css&amp;quot;&lt;/span&gt; -f markdown -t html5 -o &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$&amp;lt;&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Running &lt;code&gt;make&lt;/code&gt; at this point should checkout your current git repository to a subdirectory called &lt;code&gt;gh-pages&lt;/code&gt; (which should be added to &lt;code&gt;.gitignore&lt;/code&gt; on master).&lt;/p&gt;
&lt;p&gt;This &lt;code&gt;Makefile&lt;/code&gt; first tries to checkout an existing &lt;code&gt;gh-pages&lt;/code&gt; branch, otherwise it creates a new orphan branch for &lt;code&gt;gh-pages&lt;/code&gt;. After that, we glob the current directory for any file name &lt;code&gt;*.md&lt;/code&gt; and run it through pandoc, placing the result in &lt;code&gt;gh-pages/[whatever].html&lt;/code&gt;&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;niceities&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Niceities &lt;a href=&quot;https://tylercipriani.com/tags/shell/#niceities&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I’m a big fan of pre-processors, so the css/main.css file (which doesn’t &lt;em&gt;actually exist&lt;/em&gt; as of yet) should be converted from &lt;code&gt;less&lt;/code&gt;. The easiest way to do that: add a &lt;code&gt;package.json&lt;/code&gt; with &lt;code&gt;less&lt;/code&gt; as a dependency.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb12&quot;&gt;&lt;pre class=&quot;sourceCode numberSource json numberLines&quot;&gt;&lt;code class=&quot;sourceCode json&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb12-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;fu&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb12-2&quot; title=&quot;2&quot;&gt;  &lt;span class=&quot;dt&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;linkblog&amp;quot;&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;,&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb12-3&quot; title=&quot;3&quot;&gt;  &lt;span class=&quot;dt&quot;&gt;&amp;quot;version&amp;quot;&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;0.0.1&amp;quot;&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;,&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb12-4&quot; title=&quot;4&quot;&gt;  &lt;span class=&quot;dt&quot;&gt;&amp;quot;dependencies&amp;quot;&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb12-5&quot; title=&quot;5&quot;&gt;    &lt;span class=&quot;dt&quot;&gt;&amp;quot;less&amp;quot;&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb12-6&quot; title=&quot;6&quot;&gt;  &lt;span class=&quot;fu&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb12-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;fu&quot;&gt;}&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now running &lt;code&gt;npm install&lt;/code&gt; should create a new &lt;code&gt;node_modules&lt;/code&gt; directory (which should be added to &lt;code&gt;.gitignore&lt;/code&gt; on master). Now we need to add a &lt;code&gt;lessc&lt;/code&gt; step to our &lt;code&gt;Makefile&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb13&quot;&gt;&lt;pre class=&quot;sourceCode numberSource makefile numberLines&quot;&gt;&lt;code class=&quot;sourceCode makefile&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;dt&quot;&gt;LESSC    &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; node_modules/less/bin/lessc&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;dt&quot;&gt;LESSFILE &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; less/main.less&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-3&quot; title=&quot;3&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;dt&quot;&gt;CSSDIR  &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/css&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;dt&quot;&gt;CSSFILE &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;CSSDIR&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/main.css&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-6&quot; title=&quot;6&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;dv&quot;&gt;$(CSSFILE):&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;CSSDIR&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;LESSFILE&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-8&quot; title=&quot;8&quot;&gt;    &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;LESSC&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;LESSFILE&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;CSSFILE&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-9&quot; title=&quot;9&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-10&quot; title=&quot;10&quot;&gt;&lt;span class=&quot;dv&quot;&gt;$(CSSDIR):&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-11&quot; title=&quot;11&quot;&gt;    mkdir -p &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;CSSDIR&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Also, it’s always nice to have a &lt;code&gt;clean&lt;/code&gt; target in any &lt;code&gt;Makefile&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb14&quot;&gt;&lt;pre class=&quot;sourceCode makefile&quot;&gt;&lt;code class=&quot;sourceCode makefile&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;dv&quot;&gt;clean:&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-2&quot; title=&quot;2&quot;&gt;    rm -rf &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I’d also like to be able to preview before commiting this file by typing &lt;code&gt;make serve&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb15&quot;&gt;&lt;pre class=&quot;sourceCode makefile&quot;&gt;&lt;code class=&quot;sourceCode makefile&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;dv&quot;&gt;serve:&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-2&quot; title=&quot;2&quot;&gt;    cd &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; python -m SimpleHTTPServer&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally, speaking of commiting this file, let’s make &lt;code&gt;commit&lt;/code&gt; a target, too.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb16&quot;&gt;&lt;pre class=&quot;sourceCode makefile&quot;&gt;&lt;code class=&quot;sourceCode makefile&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb16-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;dv&quot;&gt;commit:&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb16-2&quot; title=&quot;2&quot;&gt;    cd &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; &lt;span class=&quot;ch&quot;&gt;\&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb16-3&quot; title=&quot;3&quot;&gt;        git add . &amp;amp;&amp;amp; &lt;span class=&quot;ch&quot;&gt;\&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb16-4&quot; title=&quot;4&quot;&gt;        git commit --edit --message=&lt;span class=&quot;st&quot;&gt;&amp;quot;Publish @&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;(date)&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb16-5&quot; title=&quot;5&quot;&gt;    cd &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; &lt;span class=&quot;ch&quot;&gt;\&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb16-6&quot; title=&quot;6&quot;&gt;        git push origin &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now when I update my &lt;code&gt;links&lt;/code&gt; repo’s markdown files I issue a simple series of commands: &lt;code&gt;make&lt;/code&gt; checks-out my &lt;code&gt;gh-pages&lt;/code&gt; branch and builds the html and css files, &lt;code&gt;make serve&lt;/code&gt; lets me look at the output html at &lt;code&gt;localhost:8000&lt;/code&gt;, and, finally, &lt;code&gt;make commit&lt;/code&gt; pushes those changes live.&lt;/p&gt;
&lt;p&gt;So here’s the &lt;a href=&quot;http://www.tylercipriani.com/links&quot;&gt;result&lt;/a&gt; and the final &lt;code&gt;Makefile&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb17&quot;&gt;&lt;pre class=&quot;sourceCode numberSource makefile numberLines&quot;&gt;&lt;code class=&quot;sourceCode makefile&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;dt&quot;&gt;REPO &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;shell&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; git config --get remote.origin.url&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; gh-pages&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-3&quot; title=&quot;3&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;dt&quot;&gt;LESSC    &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; node_modules/less/bin/lessc&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;dt&quot;&gt;LESSFILE &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; less/main.less&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-6&quot; title=&quot;6&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;dt&quot;&gt;CSSDIR  &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/css&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-8&quot; title=&quot;8&quot;&gt;&lt;span class=&quot;dt&quot;&gt;CSSFILE &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;CSSDIR&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/main.css&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-9&quot; title=&quot;9&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-10&quot; title=&quot;10&quot;&gt;&lt;span class=&quot;dv&quot;&gt;all:&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; init clean &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;CSSFILE&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;addprefix&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;addsuffix&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; .html&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;wildcard&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; *.md&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;))))&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-11&quot; title=&quot;11&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-12&quot; title=&quot;12&quot;&gt;&lt;span class=&quot;dv&quot;&gt;$(GHPAGES)/%.html:&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; %.md&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-13&quot; title=&quot;13&quot;&gt;    pandoc -s --template &lt;span class=&quot;st&quot;&gt;&amp;quot;_layout&amp;quot;&lt;/span&gt; -c &lt;span class=&quot;st&quot;&gt;&amp;quot;css/main.css&amp;quot;&lt;/span&gt; -f markdown -t html5 -o &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$&amp;lt;&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-14&quot; title=&quot;14&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;dv&quot;&gt;$(CSSFILE):&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;CSSDIR&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;LESSFILE&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-16&quot; title=&quot;16&quot;&gt;    &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;LESSC&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;LESSFILE&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;CSSFILE&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-17&quot; title=&quot;17&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-18&quot; title=&quot;18&quot;&gt;&lt;span class=&quot;dv&quot;&gt;$(CSSDIR):&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-19&quot; title=&quot;19&quot;&gt;    mkdir -p &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;CSSDIR&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-20&quot; title=&quot;20&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-21&quot; title=&quot;21&quot;&gt;&lt;span class=&quot;dv&quot;&gt;$(GHPAGES):&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-22&quot; title=&quot;22&quot;&gt;    &lt;span class=&quot;ch&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;echo &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;REPO&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-23&quot; title=&quot;23&quot;&gt;    git clone &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;REPO&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-24&quot; title=&quot;24&quot;&gt;    &lt;span class=&quot;ch&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;echo &lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;Donezo&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-25&quot; title=&quot;25&quot;&gt;    (cd &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; git checkout &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;) || (cd &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; git checkout --orphan &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; git rm -rf .)&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-26&quot; title=&quot;26&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-27&quot; title=&quot;27&quot;&gt;&lt;span class=&quot;dv&quot;&gt;init:&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-28&quot; title=&quot;28&quot;&gt;    &lt;span class=&quot;ch&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;command -v pandoc &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 || (echo &lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;#39;pandoc not found http://johnmacfarlane.net/pandoc/installing.html&amp;#39;&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt; &amp;amp;&amp;amp; exit 1)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-29&quot; title=&quot;29&quot;&gt;    &lt;span class=&quot;ch&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt;[ -x &lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;LESSC&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt; ] || npm install&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-30&quot; title=&quot;30&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-31&quot; title=&quot;31&quot;&gt;&lt;span class=&quot;dv&quot;&gt;serve:&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-32&quot; title=&quot;32&quot;&gt;    cd &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; python -m SimpleHTTPServer&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-33&quot; title=&quot;33&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-34&quot; title=&quot;34&quot;&gt;&lt;span class=&quot;dv&quot;&gt;clean:&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-35&quot; title=&quot;35&quot;&gt;    rm -rf &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-36&quot; title=&quot;36&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-37&quot; title=&quot;37&quot;&gt;&lt;span class=&quot;dv&quot;&gt;commit:&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-38&quot; title=&quot;38&quot;&gt;    cd &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; &lt;span class=&quot;ch&quot;&gt;\&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-39&quot; title=&quot;39&quot;&gt;        git add . &amp;amp;&amp;amp; &lt;span class=&quot;ch&quot;&gt;\&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-40&quot; title=&quot;40&quot;&gt;        git commit --edit --message=&lt;span class=&quot;st&quot;&gt;&amp;quot;Publish @&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;(date)&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-41&quot; title=&quot;41&quot;&gt;    cd &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; &lt;span class=&quot;ch&quot;&gt;\&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-42&quot; title=&quot;42&quot;&gt;        git push origin &lt;span class=&quot;ch&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt;GHPAGES&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-43&quot; title=&quot;43&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb17-44&quot; title=&quot;44&quot;&gt;&lt;span class=&quot;ot&quot;&gt;.PHONY:&lt;/span&gt;&lt;span class=&quot;dt&quot;&gt; init clean commit serve&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;

	</content>


	<link rel="comments" href="//tylercipriani.com/blog/2014/05/13/replace-jekyll-with-pandoc-makefile/#comments" type="text/html" />


	<link rel="comments" href="//tylercipriani.com/blog/2014/05/13/replace-jekyll-with-pandoc-makefile/comments.atom" type="application/atom+xml" />

</entry>
<entry>
	<title>Knowledge Nuggets From My Tmux.conf</title>

	<id>https://tylercipriani.com/blog/2013/09/12/important-lines-in-my-tmux/</id>

	<link href="https://tylercipriani.com/blog/2013/09/12/important-lines-in-my-tmux/"/>

	<author><name>Tyler Cipriani</name></author>


	<rights type="html" xml:lang="en">

		&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;
		Copyright © 2017 Tyler Cipriani

	</rights>



	<category term="computing" />

	<category term="shell" />

	<category term="tmux" />


	<updated>2017-07-01T00:49:09Z</updated>
	<published>2013-09-12T00:00:00Z</published>


	<content type="html" xml:lang="en">
	&lt;p&gt;When I switched from GNU Screen to Tmux, I was just jazzed that Tmux &lt;em&gt;had&lt;/em&gt; a status bar. To achieve that same effect in Screen I had a cryptic 115-character &lt;code&gt;hardstatus&lt;/code&gt; string that I copy–pasted from someplace lost to the annals of the Internet Archive.&lt;/p&gt;
&lt;p&gt;It wasn’t too long after I made the switch until I felt that old hacker itch and began scouring Github for Tmux tips.&lt;/p&gt;
&lt;p&gt;You can view my complete &lt;code&gt;tmux.conf&lt;/code&gt; on &lt;a href=&quot;https://github.com/thcipriani/dotfiles/blob/master/tmux.conf&quot;&gt;my github&lt;/a&gt;&lt;/p&gt;
&lt;section id=&quot;tmux-tips-for-the-uninitiated&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Tmux Tips for the Uninitiated &lt;a href=&quot;https://tylercipriani.com/tags/shell/#tmux-tips-for-the-uninitiated&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Ctrl&lt;/code&gt;-&lt;code&gt;f&lt;/code&gt; Meta is for super stars&lt;/p&gt;
&lt;p&gt;I used to always bind &lt;code&gt;Ctrl&lt;/code&gt;-&lt;code&gt;a&lt;/code&gt; to Meta to make Tmux behave like Screen; however, when you use Screen inside Tmux (as I often do with our AWS servers), hitting &lt;code&gt;Ctrl&lt;/code&gt;-&lt;code&gt;a&lt;/code&gt; &lt;code&gt;a&lt;/code&gt; can get pretty tiresome. Plus, you can’t use Readline very effectively without &lt;code&gt;Ctrl&lt;/code&gt;-&lt;code&gt;a&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb1&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;unbind-key&lt;/span&gt; C-b &lt;span class=&quot;co&quot;&gt;#no more Ctrl-b&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Switch me to ^f, thanks&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;ex&quot;&gt;set-option&lt;/span&gt; -g prefix C-f&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;ex&quot;&gt;bind-key&lt;/span&gt; f send-prefix&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Faster escape&lt;/p&gt;
&lt;p&gt;When I first started using Tmux I couldn’t stand the amount of time it took to enter copy-mode. Then I realized—I didn’t have to.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb2&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;set-option&lt;/span&gt; -sg escape-time 0&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Maximize Panes&lt;/p&gt;
&lt;p&gt;One of the things I love about Vim splits is that you can hit &lt;code&gt;Ctrl-w&lt;/code&gt; &lt;code&gt;|&lt;/code&gt; to maximize the current pane and hit &lt;code&gt;Ctrl-w&lt;/code&gt; &lt;code&gt;=&lt;/code&gt; to bring it back to an even split. Bringing that functionality to Tmux is very powerful and super easy. This line will let you hit &lt;code&gt;Meta&lt;/code&gt; &lt;code&gt;|&lt;/code&gt; to maximize a single pane and then hit &lt;code&gt;Meta&lt;/code&gt; &lt;code&gt;|&lt;/code&gt; again to bring it back to the original split.&lt;/p&gt;
&lt;p&gt;Warning: this is a tip that will only work with tmux 1.8+ (check your version via &lt;code&gt;tmux -V&lt;/code&gt;)&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb3&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;bind-key&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;resize-pane&lt;/span&gt; -Z &lt;span class=&quot;dt&quot;&gt;\;&lt;/span&gt; display-message &lt;span class=&quot;st&quot;&gt;&amp;quot;Zoom zoom zoom&amp;quot;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Vim-esque system clipboard copy–paste&lt;/p&gt;
&lt;p&gt;Sometimes system clipboard support from Vim isn’t enough. It’s convenient to be able to pull whatever is in your Tmux buffer onto your system clipboard (preferably without having to memorize any new keybindings and without overwriting any existing keybindings).&lt;/p&gt;
&lt;p&gt;First, I set the window mode-keys to use Vi bindings:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb4&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;set-window-option&lt;/span&gt; -g mode-keys vi&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next, I bind &lt;code&gt;Meta Esc&lt;/code&gt; to enter Tmux copy-mode:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb5&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;unbind-key&lt;/span&gt; [&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;ex&quot;&gt;bind-key&lt;/span&gt; Escape copy-mode&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that, I bind visual-selection and copy keys inside vi-copy mode to their Vim equivalents:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb6&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;bind-key&lt;/span&gt; -t vi-copy &lt;span class=&quot;st&quot;&gt;&amp;#39;v&amp;#39;&lt;/span&gt; begin-selection&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;ex&quot;&gt;bind-key&lt;/span&gt; -t vi-copy &lt;span class=&quot;st&quot;&gt;&amp;#39;y&amp;#39;&lt;/span&gt; copy-selection&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally, I bind &lt;code&gt;Meta y&lt;/code&gt; to execute a shell command. This should work on either Linux or OSX, although I’ve only tested this on OSX:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb7&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;if-shell&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;test &amp;quot;$(uname -s)&amp;quot; = &amp;quot;Darwin&amp;quot;&amp;#39;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;bind-key y run-shell &amp;quot;tmux show-buffer | pbcopy&amp;quot; \; display-message &amp;quot;Copied tmux buffer to system clipboard&amp;quot;&amp;#39;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;ex&quot;&gt;if-shell&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;test &amp;quot;$(uname -s)&amp;quot; = &amp;quot;Linux&amp;quot;&amp;#39;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;bind-key y run-shell &amp;quot;tmux show-buffer | xclip -sel clip -i&amp;quot; \; display-message &amp;quot;Copied tmux buffer to system clipboard&amp;quot;&amp;#39;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;OSX Specific Tmux file&lt;/p&gt;
&lt;p&gt;Even though Tmux and Vim are really popular on OSX—they are, essentially, broken. You have to do the whole &lt;code&gt;reattach-to-user-namespace&lt;/code&gt; thing to get Vim’s clipboard to play nicely inside Tmux. This mess makes your &lt;code&gt;tmux.conf&lt;/code&gt; look more cluttered and makes your dotfiles a little less portable. To fix this I keep an OSX Specific &lt;code&gt;tmux.conf&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb8&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;co&quot;&gt;#dumb osx&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;ex&quot;&gt;if-shell&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;test &amp;quot;$(uname)&amp;quot; = &amp;quot;Darwin&amp;quot;&amp;#39;&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;#39;source ~/.tmux-osx.conf&amp;#39;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Steve Losh’s Bad Wolf Status Bar&lt;/p&gt;
&lt;p&gt;News Flash: Steve Losh makes cool looking stuff. In Steve’s version of this he uses a small script to get his unread email count from his local offlineimap folder. In the version below I use a little bash script I wrote to grab weather info (that I call weathermajig).&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb9&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Bad Wolf by Steve Losh&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;co&quot;&gt;# =====================&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; status-fg white&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; status-bg colour234&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;co&quot;&gt;# set -g status-bg default #set for transparent background&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-6&quot; title=&quot;6&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; window-status-activity-attr bold&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; pane-border-fg colour245&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-8&quot; title=&quot;8&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; pane-active-border-fg colour39&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-9&quot; title=&quot;9&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; message-fg colour16&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-10&quot; title=&quot;10&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; message-bg colour221&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-11&quot; title=&quot;11&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; message-attr bold&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-12&quot; title=&quot;12&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Custom status bar&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Powerline&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-14&quot; title=&quot;14&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; status-left-length 32&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; status-right-length 150&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-16&quot; title=&quot;16&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; status-interval 5&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-17&quot; title=&quot;17&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Lets add the current weather to our status bar—why? Well Why the french-toast not?&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-18&quot; title=&quot;18&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; status-left &lt;span class=&quot;st&quot;&gt;&amp;#39;#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour238,nobold]#[fg=colour15,bg=colour238,bold] #(weathermajig boulder --short) #[fg=colour238,bg=colour234,nobold]&amp;#39;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-19&quot; title=&quot;19&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; status-right &lt;span class=&quot;st&quot;&gt;&amp;#39;#[fg=colour245]❬ %R ❬ %d %b #[fg=colour254,bg=colour234,nobold]#(rdio-current-track-tmux)#[fg=colour16,bg=colour254,bold] #h &amp;#39;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-20&quot; title=&quot;20&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; window-status-format &lt;span class=&quot;st&quot;&gt;&amp;quot;#[fg=white,bg=colour234] #I #W &amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-21&quot; title=&quot;21&quot;&gt;&lt;span class=&quot;kw&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;-g&lt;/span&gt; window-status-current-format &lt;span class=&quot;st&quot;&gt;&amp;quot;#[fg=colour234,bg=colour39]#[fg=colour16,bg=colour39,noreverse,bold] #I ❭ #W #[fg=colour39,bg=colour234,nobold]&amp;quot;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;

	</content>


	<link rel="comments" href="//tylercipriani.com/blog/2013/09/12/important-lines-in-my-tmux/#comments" type="text/html" />


	<link rel="comments" href="//tylercipriani.com/blog/2013/09/12/important-lines-in-my-tmux/comments.atom" type="application/atom+xml" />

</entry>
<entry>
	<title>Dotfile Boilerplate</title>

	<id>https://tylercipriani.com/blog/2013/08/10/dotfiles-how-to-get-started/</id>

	<link href="https://tylercipriani.com/blog/2013/08/10/dotfiles-how-to-get-started/"/>

	<author><name>Tyler Cipriani</name></author>


	<rights type="html" xml:lang="en">

		&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;
		Copyright © 2017 Tyler Cipriani

	</rights>



	<category term="computing" />

	<category term="shell" />


	<updated>2017-07-01T00:49:09Z</updated>
	<published>2013-08-10T00:00:00Z</published>


	<content type="html" xml:lang="en">
	&lt;p&gt;Earlier today I made a tweak to one of my ever-growing collection of &lt;a href=&quot;https://github.com/thcipriani/dotfiles/&quot;&gt;dotfiles&lt;/a&gt; and it reminded me that I’m not too happy with my dotfile’s &lt;code&gt;bootstrap&lt;/code&gt; script.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;bootstrap&lt;/code&gt; file that I have in my repo is from &lt;a href=&quot;http://errtheblog.com/posts/89-huba-huba&quot;&gt;a 2008 blog post&lt;/a&gt; and I’ve never been too thrilled with it.&lt;/p&gt;
&lt;p&gt;The problems my old &lt;code&gt;boostrap&lt;/code&gt; were&lt;/p&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;It required that Ruby be installed—which was a pain on production servers where I never intended to have Ruby installed.&lt;/li&gt;
&lt;li&gt;It overwrote any existing dotfiles in &lt;code&gt;$HOME&lt;/code&gt; without warning&lt;/li&gt;
&lt;li&gt;It added every sub-directory/file in the .dotfiles directory—you couldn’t add a README.md file without it being symlinked in the &lt;code&gt;$HOME&lt;/code&gt; directory as &lt;code&gt;.README.md&lt;/code&gt;—silly, right?!&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Long story short—I needed a new &lt;code&gt;bootstrap&lt;/code&gt; file. I’m a big believer in not reinventing the wheel, so I went looking for the canonical example of the dotfile bootstrap file.&lt;/p&gt;
&lt;p&gt;I started perusing dotfile repos on github—which is always exciting to me (because I’m super nerdy) and there are some amazing dotfile resources on github:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dotfiles.github.io/&quot;&gt;Github ❤ ~/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/mathiasbynens/dotfiles&quot;&gt;Mathias Bynens’ Sensible Hacker Defaults for OSX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/gf3/dotfiles&quot;&gt;gf3’s Sexy Bash Prompt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://zachholman.com/2010/08/dotfiles-are-meant-to-be-forked/&quot;&gt;Zach Holman’s Bootstrap script&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/addyosmani/dotfiles/blob/master/.aliases&quot;&gt;Addy Osmani’s Handy Aliases&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/pengwynn/dotfiles&quot;&gt;pengwynn’s There’s no place like ~/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Seeing all of this got me to thinking—wouldn’t it be great if there were a project that amalgamated all of this fun stuff? Like HTML5 Boilerplate for dotfiles.&lt;/p&gt;
&lt;p&gt;The project will keep canonical examples of files like the &lt;code&gt;bootstrap&lt;/code&gt; script. It would also keep an opinionated list of functions, aliases and configurations that could help beginners get a great start and normalize dotfile distribution in the same way that pathogen normalized vim plugins into bundles.&lt;/p&gt;
&lt;section id=&quot;dotfile-boilerplate&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Dotfile Boilerplate &lt;a href=&quot;https://tylercipriani.com/tags/shell/#dotfile-boilerplate&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So there’s the starting point: &lt;a href=&quot;https://github.com/thcipriani/dotfile-boilerplate&quot;&gt;Dotfile Boilerplate&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;At the very least it’s a solidly structured start with an amazing bootstrap script that I modfied based off of Zach Holman’s setup.&lt;/p&gt;
&lt;p&gt;So that’s the whole idea—the hope is that this repository can grow and collect great ideas, functions, and well-considered dotfiles from interesting discussions and people around the internet.&lt;/p&gt;
&lt;p&gt;Beginners will have an amazing starting point and advanced users will have a wellspring of ideas.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://help.github.com/articles/using-pull-requests/&quot;&gt;Fork ‘em if ya got ‘em.&lt;/a&gt;&lt;/p&gt;
&lt;/section&gt;

	</content>


	<link rel="comments" href="//tylercipriani.com/blog/2013/08/10/dotfiles-how-to-get-started/#comments" type="text/html" />


	<link rel="comments" href="//tylercipriani.com/blog/2013/08/10/dotfiles-how-to-get-started/comments.atom" type="application/atom+xml" />

</entry>
<entry>
	<title> Vim, the OSX clipboard and Tmux</title>

	<id>https://tylercipriani.com/blog/2013/02/09/vim-mac-osx-tmux-clipboard/</id>

	<link href="https://tylercipriani.com/blog/2013/02/09/vim-mac-osx-tmux-clipboard/"/>

	<author><name>Tyler Cipriani</name></author>


	<rights type="html" xml:lang="en">

		&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;
		Copyright © 2017 Tyler Cipriani

	</rights>



	<category term="computing" />

	<category term="shell" />

	<category term="tmux" />

	<category term="vim" />


	<updated>2017-07-01T00:49:09Z</updated>
	<published>2013-02-09T00:00:00Z</published>


	<content type="html" xml:lang="en">
	&lt;p&gt;I’ve been an Ubuntu user for 4 years now. Since I started working at Upsync 3 months ago, I’ve found myself a very lonely desktop Linux user. Also, since this job is my first heavy-duty exposure to back-end web development, I’ve found myself a very confused desktop Linux user.&lt;/p&gt;
&lt;p&gt;While there are many tools for working on a website backend available in Ubuntu, few are as shiny as those available in OSX (Charles Proxy, usable in Chrome. I want that. I want it hard.). Also, want to do any iOS work? (you know I do)—then you &lt;em&gt;must&lt;/em&gt; have a mac.&lt;/p&gt;
&lt;p&gt;On the flip side there is my natural inclination to be a bit of a contrarian and principles and such…&lt;/p&gt;
&lt;p&gt;##…but it’s so shiny!&lt;/p&gt;
&lt;p&gt;I’ve caved. I’m a sell-out. I’m not the cool hardcore ideologue I once believed myself to be. You know those hypothetical, &lt;em&gt;which-side-of-history-would-you-be-on-type&lt;/em&gt;, questions? Well, I can now safely say that I would &lt;em&gt;not&lt;/em&gt; have been in the French Resistance.&lt;/p&gt;
&lt;p&gt;I’m typing this on the beautiful back-lit keyboard of a brand-new, core-i7-having, 8GB-RAM-possesing, 256GB-SSD-not-spinning monster that is a 13″ MacBook Air.&lt;/p&gt;
&lt;p&gt;##I thought this was supposed to be easy&lt;/p&gt;
&lt;p&gt;The first thing I did was get iTerm 2 up and running and then install Homebrew. After removing the dumb “Natural” scrolling and using PCKeyboard hack to remap some keys, I’m working exactly as I was before. I really can’t tell a difference. Which is a little anti-climactic for a computer that cost as much as my first car (oh, how I miss that purple Taurus!).&lt;/p&gt;
&lt;p&gt;It was really easy to get everything set up as it was before, except…Vim…my clipboard…Tmux…they didn’t work together and that was CRIPPLING! Seriously, I depend on those things working together.&lt;/p&gt;
&lt;p&gt;This post is written as a little reminder to myself of how I got it all up and running again.&lt;/p&gt;
&lt;p&gt;##The process&lt;/p&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Install Homebrew:&lt;/strong&gt;&lt;br /&gt;Instructions are available on &lt;a href=&quot;http://mxcl.github.com/homebrew/&quot; title=&quot;Homebrew&quot;&gt;Github&lt;/a&gt; but really all it boils down to is: &lt;code&gt;ruby -e “$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)”&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Install MacVim:&lt;/strong&gt;&lt;br /&gt;And make sure it overrides the system default Vim, which is pre-7.3 Vim and sucks (or it was last week when my MacBook got here) use: &lt;code&gt;brew install macvim –override-system-vim&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Install Tmux:&lt;/strong&gt;&lt;br /&gt;Easy peesy lemon squeezy: &lt;code&gt;brew install tmux&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Thank the good, sweet lord for Paul Hinze:&lt;/strong&gt;&lt;br /&gt; Install Paul’s reattach-to-user-namespace hack via homebrew: &lt;code&gt;brew install reattach-to-user-namespace –wrap-pbcopy-and-pbpaste&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Append your &lt;code&gt;~/.tmux.conf&lt;/code&gt; file&lt;/strong&gt;:&lt;br /&gt;With this lovely gem: &lt;code&gt;set-option -g default-command “reattach-to-user-namespace -l zsh”&lt;/code&gt; or you can use bash, I guess, I don’t know because I use ZSH. That should be a step somewhere…&lt;code&gt;chsh -s /bin/zsh&lt;/code&gt;. Done.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now if only OSX Mountain Lion possessed the awesome power of moving windows between workspaces using keyboard shortcuts. Someday… someday.&lt;/p&gt;

	</content>


	<link rel="comments" href="//tylercipriani.com/blog/2013/02/09/vim-mac-osx-tmux-clipboard/#comments" type="text/html" />


	<link rel="comments" href="//tylercipriani.com/blog/2013/02/09/vim-mac-osx-tmux-clipboard/comments.atom" type="application/atom+xml" />

</entry>
<entry>
	<title>My ZSH (and bash) prompt</title>

	<id>https://tylercipriani.com/blog/2012/12/18/zsh-prompt-customization/</id>

	<link href="https://tylercipriani.com/blog/2012/12/18/zsh-prompt-customization/"/>

	<author><name>Tyler Cipriani</name></author>


	<rights type="html" xml:lang="en">

		&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;
		Copyright © 2017 Tyler Cipriani

	</rights>



	<category term="computing" />

	<category term="shell" />


	<updated>2017-07-01T00:49:09Z</updated>
	<published>2012-12-18T00:00:00Z</published>


	<content type="html" xml:lang="en">
	&lt;figure&gt;
&lt;img src=&quot;http://tylercipriani-files.s3.amazonaws.com/blog/junkfoodtheme.png&quot; alt=&quot;Junkfood theme in git directory&quot; /&gt;&lt;figcaption&gt;Junkfood theme in git directory&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;In order to become a card-carrying Linux user, I feel like you &lt;em&gt;need&lt;/em&gt; to have spent a truly astounding amount of time fiddling with your &lt;a href=&quot;https://github.com/thcipriani/dotfiles&quot;&gt;dotfiles.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Me? I’ve gone way beyond the point of diminishing returns. Past the point where anyone who loves me can even feign interest. And now I’m quaffing the sweet nectar of victory, and that victory nectar &lt;em&gt;is&lt;/em&gt; sweet. Oh yes, that’s right: my insanely customized prompt is now a part of &lt;a href=&quot;http://github.com/robbyrussell/oh-my-zsh&quot;&gt;Bobby Russell’s Oh-My-ZSH&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I’m feeling the pride, joy, and anxiety that can only come from watching my little utf-8 baby move beyond my home directory and march deep into the uncharted home directories of what I can only assume are &lt;strong&gt;BILLIONS&lt;/strong&gt; of users.&lt;/p&gt;
&lt;section id=&quot;all-your-oh-my-zsh-are-belong-to-us&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;All your Oh-My-ZSH are belong to us! &lt;a href=&quot;http://knowyourmeme.com/memes/all-your-base-are-belong-to-us&quot;&gt;*&lt;/a&gt; &lt;a href=&quot;https://tylercipriani.com/tags/shell/#all-your-oh-my-zsh-are-belong-to-us&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;…or it will when you update your theme. See, cause, oh-my-zsh uses &lt;a href=&quot;http://github.com/robbyrussell/oh-my-zsh/tree/master/themes/&quot;&gt;themes&lt;/a&gt; to specify how your prompt looks. You can define what theme you’d like to use in your &lt;code&gt;~/.zshrc&lt;/code&gt; file. On or around line 8 you’ll want to update the line that starts with &lt;code&gt;ZSH_THEME=…&lt;/code&gt; to look like this:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb1&quot;&gt;&lt;pre class=&quot;sourceCode bash lineNumbers&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Set name of the theme to load.&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Look in ~/.oh-my-zsh/themes/&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Optionally, if you set this to &amp;quot;random&amp;quot;, it&amp;#39;ll load a random theme each&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;co&quot;&gt;# time that oh-my-zsh is loaded.&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;va&quot;&gt;ZSH_THEME=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;junkfood&amp;quot;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;almost-not-quite&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Almost, not quite… &lt;a href=&quot;https://tylercipriani.com/tags/shell/#almost-not-quite&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Like any good dotfile obsessive, I’ve continued to make changes to this prompt since I made my pull request to ole Robby! I’ve modified the prompt to show the same sort of branch information about SVN repos that it currently displays for git repos (e.g., current branch name and local modifications). That little code chestnut is available over on &lt;a href=&quot;https://github.com/thcipriani/oh-my-zsh&quot;&gt;my fork of the oh-my-zsh build&lt;/a&gt;.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;bash-junkfood-theme&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Bash Junkfood theme &lt;a href=&quot;https://tylercipriani.com/tags/shell/#bash-junkfood-theme&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I also have a version of this prompt for Bash that I’ve made in preperation for the undoubted overwhelming demand that I expect to begin any time now:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb2&quot;&gt;&lt;pre class=&quot;sourceCode bash lineNumbers&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;co&quot;&gt;# An extravagent PS1 http://blog.bigdinosaur.org/easy-ps1-colors/&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;kw&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;fu&quot;&gt; prompt&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-3&quot; title=&quot;3&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# 30m - Black&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-4&quot; title=&quot;4&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# 31m - Red&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-5&quot; title=&quot;5&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# 32m - Green&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-6&quot; title=&quot;6&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# 33m - Yellow&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-7&quot; title=&quot;7&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# 34m - Blue&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-8&quot; title=&quot;8&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# 35m - Purple&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-9&quot; title=&quot;9&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# 36m - Cyan&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-10&quot; title=&quot;10&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# 37m - White&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-11&quot; title=&quot;11&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# 0 - Normal&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-12&quot; title=&quot;12&quot;&gt;  &lt;span class=&quot;co&quot;&gt;# 1 - Bold&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-13&quot; title=&quot;13&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;BLACK=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[0;30m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-14&quot; title=&quot;14&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;BLACKBOLD=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[1;30m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-15&quot; title=&quot;15&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;RED=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[0;31m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-16&quot; title=&quot;16&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;REDBOLD=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[1;31m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-17&quot; title=&quot;17&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;GREEN=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[0;32m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-18&quot; title=&quot;18&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;GREENBOLD=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[1;32m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-19&quot; title=&quot;19&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;YELLOW=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[0;33m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-20&quot; title=&quot;20&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;YELLOWBOLD=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[1;33m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-21&quot; title=&quot;21&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;BLUE=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[0;34m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-22&quot; title=&quot;22&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;BLUEBOLD=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[1;34m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-23&quot; title=&quot;23&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;PURPLE=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[0;35m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-24&quot; title=&quot;24&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;PURPLEBOLD=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[1;35m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-25&quot; title=&quot;25&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;CYAN=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[0;36m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-26&quot; title=&quot;26&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;CYANBOLD=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[1;36m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-27&quot; title=&quot;27&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;WHITE=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[0;37m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-28&quot; title=&quot;28&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;WHITEBOLD=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;\[\033[1;37m\]&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-29&quot; title=&quot;29&quot;&gt;  &lt;span class=&quot;bu&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;va&quot;&gt;PS1=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$WHITEBOLD&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;# &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$GREEN&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;\u&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$WHITEBOLD&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;. &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$BLUE&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;\h&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$WHITEBOLD&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;. &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$YELLOW&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;\d&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$WHITE&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; at &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$PURPLE&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;\@&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$WHITEBOLD&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;. &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$CYAN&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;\w\n  &lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$WHITE&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-30&quot; title=&quot;30&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-31&quot; title=&quot;31&quot;&gt;&lt;span class=&quot;ex&quot;&gt;prompt&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;prompt-inspiration&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Prompt Inspiration &lt;a href=&quot;https://tylercipriani.com/tags/shell/#prompt-inspiration&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Most of the inspiration for moving to ZSH and for creating this &lt;em&gt;extravagant&lt;/em&gt; (to borrow a phrase) prompt came from a blog post written by Mr. Steve Losh called, &lt;a href=&quot;http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#oh-my-zsh&quot;&gt; “My Extravagant ZSH Prompt”&lt;/a&gt;.&lt;/p&gt;
&lt;/section&gt;

	</content>


	<link rel="comments" href="//tylercipriani.com/blog/2012/12/18/zsh-prompt-customization/#comments" type="text/html" />


	<link rel="comments" href="//tylercipriani.com/blog/2012/12/18/zsh-prompt-customization/comments.atom" type="application/atom+xml" />

</entry>

</feed>
