-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
1 lines (1 loc) · 26.6 KB
/
atom.xml
1
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>ype</title><link href="http://env.sh/atom.xml" rel="self"/><link href="http://env.sh/"/><updated>2014-12-17T11:18:33-07:00</updated><id>http://env.sh</id><author><name>anton</name><email></email></author><entry><title>Ag, Silver Searching in Emacs</title><link href="http://env.sh/posts/2014/04/08/silver-searching-in-emacs"/><updated>2014-04-08T00:00:00-06:00</updated><id>http://env.sh/posts/2014/04/08/silver-searching-in-emacs</id><content type="html"><p><span class="dropcap">I</span> always seem to run into the constant problem of having to change multiple variables, symbols, function names, and other usually mundane parts of my code on a regular basis. Most likely due to the fact that I first name everything in a random, train of thought manner, only realising later that a more useful, explanatory definition is required.</p><p>Up until last night I found myself opening and closing multiple files after spending a few minutes in each finding and replacing keywords, and then ultimately running my code to find out I missed a few in this file, and a few in that file.</p><p>Take for example two files - one named foobar, and the other named foofoo. In both foobar and foofoo I have a something with the keywords foofunct. Now this something (variable, function, whatever) needs to have the same name in both these files. So I decided while editing the first file foobar that I want to change foofunct to foodef. With the change made to foobar lock in place and saved, I attempt to run my code, ultimately to be greeted by the wonderful world of errors saying something of the sort &ldquo;your doing it wrong, I can&rsquo;t find your flipping foofunct in foofoo anymore because it&rsquo;s not in foobar&rdquo;</p><p>Now this is an ongoing problem I&rsquo;ve had and have always thought there has to be a better way&#x2026;</p><h1>Well maybe I&#39;m just ignorant</h1><p>Enter &ldquo;The Silver Searcher&rdquo; or &ldquo;ag&rdquo; for sort. Ag is a wonderful command line tool that lets you quickly search a code file, or set of files, to find a specific keyword within those file. Ag from the command line is awesome, but Ag in Emacs is amazing. By adding a few simple lines to my dotemacs file I am not able to find, replace, and view a single keyword across multiple files within a matter of seconds.</p><h1>Adding some silver to your search (the code bit)</h1><p>First you are going to have to make sure you have ag installed.</p><p>On Mac you can do this through homebrew very easily (if you don&rsquo;t have homebrew installed already, join the future and install it)</p><ol><li><p>Homebrew</p><div class="highlight"><pre><code class="language-text" data-lang="text">$ brew install the_silver_searcher</code></pre></div></li><li><p>Macports</p><div class="highlight"><pre><code class="language-text" data-lang="text">$ port install the_silver_searcher</code></pre></div></li><li><p>Linux (Debian/Ubuntu)</p><div class="highlight"><pre><code class="language-text" data-lang="text">$ apt-get install silversearcher-ag</code></pre></div></li></ol><p><em>note: substitute <code>apt-get</code> for whichever package manager you use regularly</em></p><h2>In your dotemacs</h2><p>In your dotemacs you need a few things. (before you do anything use <code>M-x package-install</code> to get the required packages <code>ag</code> and <code>wgrep</code> (optional (projectile)) ;;it makes things a whole lot nicer</p><div class="highlight"><pre><code class="language-lisp" data-lang="lisp"><span class="p">(</span><span class="nb">when</span> <span class="p">(</span><span class="nv">executable-find</span> <span class="s">&quot;ag&quot;</span><span class="p">)</span><span class="p">(</span><span class="nb">require</span> <span class="ss">&#39;ag</span><span class="p">)</span><span class="p">(</span><span class="nb">require</span> <span class="ss">&#39;wgrep-ag</span><span class="p">)</span><span class="p">(</span><span class="nv">setq-default</span> <span class="nv">ag-highlight-search</span> <span class="no">t</span><span class="p">)</span><span class="p">(</span><span class="nv">global-set-key</span> <span class="p">(</span><span class="nv">kbd</span> <span class="s">&quot;H-q&quot;</span><span class="p">)</span> <span class="ss">&#39;ag-project</span><span class="p">)</span><span class="p">(</span><span class="nv">global-set-key</span> <span class="p">(</span><span class="nv">kbd</span> <span class="s">&quot;H-z&quot;</span><span class="p">)</span> <span class="ss">&#39;projectile-ag</span><span class="p">))</span> <span class="c1">; if you have projectile</span></code></pre></div><p>As you might noticed I am using Hyper-q <code>H-q</code> and Hyper-z <code>H-z</code> as hot keys for ag-*(whatever), you can change these to suit your preferred keybinding style.</p><p>A few other useful keybindings you may want to check out are <code>C-x C-p</code>, this makes the search buffer writable and lets you edit results inline. Also, <code>C-c C-f</code>, which activates <code>next-error-follow-minor-mode</code>, a nifty feature that quickly opens the file matching the search result your cursor is currently over.</p><p>The gif show at the top of this page is a demo of how I use it to navigate my emacs.d nightmare...here it is again so you don&#39;t have to scroll up to see it.</p><div><img src="/media/2014-04-08-silver-searching-in-emacs/silverSearcher.gif" alt="Silver Searching in Emacs" width="100%" /><blockquote style="border-left: 10px solid #D5D5D5;">Silver Searching in Emacs</blockquote></div><h1>In (somewhat of a haphazard) Conclusion</h1><p>With the setup complete you can now move you cursor over any variable, function name, definition, word, whatever and run ag on it to find all the uses of it in either a project, file, or if you&rsquo;re feel ambitious your entire system (be warned, this sucks the life out of everything and may take a billion years to complete)</p></content></entry><entry><title>Get Things Done:<br/>STM32 Development</title><link href="http://env.sh/posts/2014/01/22/stm-dev-notes"/><updated>2014-01-22T00:00:00-07:00</updated><id>http://env.sh/posts/2014/01/22/stm-dev-notes</id><content type="html"><p><span class="dropcap">T</span>his article will go through the required steps to setup an environment for writing, programming, and debugging code for ARM Cortex-M processor. As I am predominately a OS X user (sometimes Linux depending on my mood) the information provided is tailored towards OS X users, however, as all of the tools used in the setup are open-source, the information should be transferable to other platforms.</p><h1>Setup</h1><h2>Parts List</h2><p><a href="http://uk.farnell.com/stmicroelectronics/stm32vldiscovery/stm32f100-st-link-discovery-kit/dp/1824325">ST STM32VL-DISCOVERY board</a>- or any other ARM Cortex-M Processor, however most of the examples shown will be for the STM32VL</p><p><a href="http://uk.farnell.com/jsp/search/productdetail.jsp?SKU=1892523">ST-Link/v2</a> (or other compatible ICD/Programmer, for STM32)</p><ul><li>NOTE: If you have the STM32VL-Discovery board, there is an ST-Link built-in, and it is not required to get an external ST-Link, however if you plan on developing custom projects built around the ST range of microcontrollers it may be worth to get one.</li></ul><p><strong>You will also need:</strong></p><ul><li>Wires, LED and other components you may want to play around with, note that for each example I will list the parts used with links to where you can get them.</li><li>A computer, but given you are reading this I am going to assume you have one.</li></ul><h2>Toolchain</h2><h3>Homebrew installation</h3><p>To manage packages on my mac (OS X 10.9), I use homebrew, so I will show you how to set that up, however if you are on Linux, or prefer a different package manager (i.e. macports), most of these packages should be available. You can also alternatively install all of these packages manually, though I would advise against it, as in my experience it can be a road riddled with bugs.</p><p><em>Homebrew install</em></p><div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>ruby -e <span class="s2">&quot;$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)&quot;</span><span class="nv">$ </span>brew doctor</code></pre></div><h3>gcc-arm-none-eabi install</h3><p>You are going to need a compiler to generate your object code that will be loaded onto your microcontroller. To do this you are going to need a toolchain. The GNU toolchain for ARM Cortex-M and Cortex-R processors is really great, and can be easily installed using homebrew.</p><p>(Note: you can use an IDE for ARM development, however the examples and instructions here are built around the GNU ARM toolchain. Further, if you are developing on OS X or Linux IDE support for ARM development is limited with most being built specifically for Windows)</p><p><em>Installing the GNU Toolchain with Homebrew</em></p><div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>brew install https://raw.github.com/PX4/homebrew-px4/master/gcc-arm-none-eabi-47.rb</code></pre></div><hr><h2>ST-LINK</h2><p>The ST-Link (or compatible ICD/Programmer) is essential for ARM microcontroller development. It is an in-circuit debugger and programmer for the STM8 and STM32 microntroller families.</p><h3>Installing ST-Link Utils using Homebrew</h3><div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>brew install automake autoconf libusb libusb-compat<span class="nv">$ </span>sudo easy_install pyyaml<span class="nv">$ </span>mkdir ~/Development<span class="nv">$ </span><span class="nb">cd</span> ~/Development<span class="nv">$ </span>mkdir ~/Development/embedded<span class="nv">$ </span><span class="nb">cd</span> ~/Development/embedded<span class="nv">$ </span>mkdir ~/Development/embedded/tools<span class="nv">$ </span><span class="nb">cd</span> ~/Development/embedded/tools<span class="nv">$ </span>git clone https://github.com/texane/stlink.git<span class="c">#ST-LINK command line utility</span><span class="c">#Source: https://github.com/texane/stlink</span><span class="nv">$ </span><span class="nb">cd</span> ~/Development/embedded/tools/stlink/<span class="nv">$ </span>./autogen.sh<span class="nv">$ </span>./configure<span class="nv">$ </span>make</code></pre></div><h3>Extra Configurations for ST-Link/v1</h3><p>The ST-Link/v1&rsquo;s SCSI emulation is very broken, You will need to tell your operating system to ignore the ST-Link/v1, as the SCSI emulation on it doesn&rsquo;t play nice with UNIX systems.</p><p><em>Do one of the following before using your ST-Link</em></p><p><strong>Option 1:</strong></p><div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>modprobe -r usb-storage<span class="nv">$ </span>modprobe usb-storage <span class="nv">quirks</span><span class="o">=</span>483:3744:i</code></pre></div><p><strong>Option 2:</strong></p><div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#add &quot;options usb-storage quirks=483:3744:i&quot; to /etc/modprobe.conf</span><span class="c">#then</span><span class="nv">$ </span>modprobe -r usb-storage<span class="nv">$ </span>modprobe usb-storage</code></pre></div><p><strong>Option 3:</strong></p><div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>cp stlink_v1.modprobe.conf /etc/modprobe.d<span class="c">#then</span><span class="nv">$ </span>modprobe -r usb-storage<span class="nv">$ </span>modprobe usb-storage</code></pre></div><h3>Notes forST-Link/v2</h3><p>The ST-Link/v2 should work right away, nevertheless, doing the above fix for STLINKv1 won&rsquo;t hurt anything and will prevent you from having to do the work later if you are using an ST-Link/v1.</p><h3>Using ST-Util</h3><ul><li>You must launch st-util with &ldquo;-1&rdquo; flag <a href="https://github.com/texane/stlink/issues/182">(source)</a></li></ul><div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span>/path_to_stlink/st-utils -1<span class="c">#or if you have added the stlink folder to your path</span><span class="nv">$ </span>st-utils -1</code></pre></div><hr><h1>Setting up a Development Environment for STM32 Projects</h1><h2>Option 1, Firmware Lib =&gt; Simple</h2><h3>libopencm3<a id="sec-2-1-1" name="sec-2-1-1"></a></h3><p>The libopencm3 project is a good place to start with ST programming. Featuring a large free/libre/open-source (LGPL v3, or later) firmware library for various ARM Cortex-M3 microcontrollers, including the ST STM32 range, libopencm3 offers examples, community and documentation to help for a smooth transition from Arduino to ARM.</p><p>To get more familiar with libopencm3 go to there main wiki @ <a href="http://libopencm3.org/wiki/Main_Page"><a href="http://libopencm3.org/wiki/Main_Page">http://libopencm3.org/wiki/Main_Page</a></a></p><h3>libopencm3 quick start</h3><p>The code below will help you to setup a workflow to develop for ARM Cortex-M microcontrollers using the resources available from libopencm3.</p><div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span><span class="nb">cd</span> ~/Development/embedded/<span class="nv">$ </span>git clone https://github.com/libopencm3/libopencm3-examples.git<span class="nv">$ </span><span class="nb">cd </span>libopencm3-examples<span class="nv">$ </span>git submodule init<span class="nv">$ </span>git submodule update<span class="nv">$ </span>make</code></pre></div><p><em>Test to see everything works</em></p><p>(Note: The Example below is for the <a href="http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/CD00267113.pdf">ST STM32VL-DISCOVERY board</a>)</p><div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nv">$ </span><span class="nb">cd </span>examples/stm32/f1/stm32vl-discovery/miniblink/<span class="nv">$ </span>make<span class="nv">$ </span><span class="nb">cd</span> ~/Development/embedded/tools/stlink/<span class="nv">$ </span>./st-util<span class="c">#Short way</span><span class="nv">$ </span>arm-none-eabi-gdb miniblink.elf -ex <span class="s2">&quot;tar ext :4242&quot;</span><span class="o">(</span>gdb<span class="o">)</span> load<span class="o">(</span>gdb<span class="o">)</span> <span class="k">continue</span></code></pre></div><h2>Option 2, Bare Metal =&gt; Fiddly</h2><ul><li>(Coming Soonish)</li></ul><h1>Helpful resources</h1><p>Here is a list of helpful links to tutorials and information to get you started on the path to development using ARM microcontrollers</p><ul><li><p><strong>STM32 Open Source Course</strong></p><ul><li><a href="http://homes.soic.indiana.edu/geobrown/c335.php">Course Page</a></li><li><a href="https://github.com/geoffreymbrown/STM32-Template">Build template for projects using the STM32VL-Discovery Board</a></li><li>Book<ul><li><a href="http://www.cs.indiana.edu/%7Egeobrown/book.pdf">Discovering the STM32 Microcontroller</a></li></ul></li></ul></li><li><p><strong>libopencm3</strong></p><ul><li><a href="http://libopencm3.org/wiki/Main_Page">Wiki - Main Project Page</a></li><li><a href="https://github.com/libopencm3/libopencm3">github/libopencm3</a></li><li><a href="https://github.com/libopencm3/libopencm3-examples">github/libopencm3-examples</a></li><li><a href="http://libopencm3.github.io/docs/latest/stm32f1/html/modules.html">libopencm3 API Documentation</a></li></ul></li><li><p><strong>Reference Manuals</strong></p><ul><li><a href="http://infocenter.arm.com/help/topic/com.arm.doc.ddi0337h/DDI0337H_cortex_m3_r2p0_trm.pdf">Cortex-M3 Reference Manual</a></li><li><a href="http://www.st.com/web/en/resource/technical/document/reference_manual/CD00171190.pdf">RM0008: STM32F1xx</a></li><li><a href="http://www.st.com/web/en/resource/technical/document/reference_manual/CD00246267.pdf">RM0041: STM32F100xx</a></li></ul></li></ul></content></entry><entry><title>The Emacs Curse</title><link href="http://env.sh/posts/2013/11/08/problematic-procrastination"/><updated>2013-11-08T00:00:00-07:00</updated><id>http://env.sh/posts/2013/11/08/problematic-procrastination</id><content type="html"><p><span class="dropcap">It</span> never ceases to amaze me how long I can procrastinate before actually deciding to get shit done. It would maybe be not as troubling if I hated what I do on a daily basis, or the work that I had to get done was mind numbing dull, but it&rsquo;s unfortunately not (I saw unfortunately because then I would have an excuse as to why I&rsquo;m a lazy sod).</p><h2>Brief notes on a day</h2><p>I would like to say I wake up energised and rearing to go, but like most, I wake in a fog, dragging my sulking ass out of bed, trying desperately to summon some celestial force to help me muster the focus to stay on track with tasks I need to get done. Side note: Freelance is the procrastinators worst nightmare (although I have found many a way to procrastinate in a normal work environment as well, see also: reverse toilet sleeping)</p><p>After raking large amounts of crust from my tired eyes I start my already behind day with a cup of tea and a wonderfully delicious cigarette (if you don&rsquo;t smoke you should try it, really it&rsquo;s a lot of fun (no sarcasm, just pure smoking love))</p><p>Smoking and tea drinking over, I either turn on some stupid cartoon on one of a handful of streaming TV websites and proceed to say at the end of every episode &ldquo;after this one I&rsquo;ll get to work&rdquo; - this has become problematic to the point that I downloaded an app to block specific sites (unfortunately I never turn this app on).</p><p>Once TV show watching has been completed I continue doing absolutely useless, time wasting activities - one of my favourite being the aimless pursuit of customising Emacs to the point of insanity.</p><h2>The Emacs Curse</h2><p>I believe Richard Stallman whilst designing Emacs, deviously devised to create a piece of shit, almost text editor, time vampire that was more addictive then Facebook or all its other time sucking compadres.</p><p>Half serial time killer, half insane genius, Stallman created the bane of my existence, as for some reason I feel as though changing my dotemacs file is somehow kind of like doing actual work - this is not the case.</p><h2>The calm after the storm</h2><p>With the drudge through the wasteland that is my morning over, actual money making, cash flowing work can begin - this usually means possibly taking a shower and then eating food so that around 3pm I can start sewing, soldering, or hacking some slapped together, haphazardly made project together.</p><p>All in all work does get done and deadlines are hit, but oh how I crave the day when this process is mitigated down to a streamline flow making a 40 hour work week possibly possible.</p><h1>In (ardently needed) conclusion</h1><p>It&rsquo;s a love hate thing in my opinion - procrastination is beautiful - almost wonderful to say the least - the unfortunate part is that ignorance does not exist, making it virtually impossible to forget the fact that if all the chaff could be removed, I might actually build something useful for myself, and possibly others.</p><p>Another 20 minutes down the drain writing this god forsaken pile of empty words - I really hope you didn&rsquo;t read to the end of this - if so go to some work, or find a better blog to read.</p><p>I like turtles.</p></content></entry><entry><title>virtually, a new beginning</title><link href="http://env.sh/posts/2013/11/04/virtually-a-new-beginning"/><updated>2013-11-04T00:00:00-07:00</updated><id>http://env.sh/posts/2013/11/04/virtually-a-new-beginning</id><content type="html"><p><span class="dropcap">I</span> decided, one fateful day (or maybe not so fateful, but rather ill-conceived) - that it would be a good idea to blog using orgmode. I use orgmode for many things - scheduling, expenses, charts of varying kind, time-tracking, the list goes on. Blogging in org seemed like a natural extension of this already ill-fated, ill-conceived, awesomely nerd trapped system I have developed for myself.</p><h2>How it all came together</h2><p>This blog uses a combination of a few tools that have become very dear to me - the aforementioned orgmode, ispell (because I&rsquo;m using friggin emacs to write all this drivel), a ruby static site generator - nanoc, and some hacked together bits of code (one of which is org-ruby, I&rsquo;ll explain this one in detail at a later time - there is a surprisingly limited amount of documentation on how to use it effectively)</p><p>All of this heaping junk pile of snippets has come together in isoty.pe - my effort to help clog the stinking drain that the Internet has become (don&rsquo;t get me wrong I spend a good majority of my time in this cesspool of delights).</p><h2>In [very needed] Conclusion</h2><p>I feel I should warn, alert, tell you what you will encounter on this site - don&rsquo;t be afraid, it&rsquo;s not a NSFW warning (it could be a little though I guess, as your boss probably would not enjoy you wasting endless hours looking at pointless pictures of pandas) - the site is my endless hacking, tweaking, replace-stringing of the various tools I use on a daily basis to GSD (for the GTD crowd GSD is my version where I replace the David Allen acronym &ldquo;Get Things Down&rdquo; with the more work appropriate &ldquo;Get Shit Done&rdquo;)</p><p>I hope you enjoy this journey to the deep, bon voyage to sanity, this different, but hopefully better foray into Internet cesspiting.</p></content></entry></feed>