-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeed.xml
More file actions
60 lines (42 loc) · 17.2 KB
/
feed.xml
File metadata and controls
60 lines (42 loc) · 17.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xml" href="https://smpeters.github.io/feed.xslt.xml"?><feed xmlns="http://www.w3.org/2005/Atom"><generator uri="http://jekyllrb.com" version="3.3.1">Jekyll</generator><link href="https://smpeters.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://smpeters.github.io/" rel="alternate" type="text/html" /><updated>2016-12-29T21:11:58-06:00</updated><id>https://smpeters.github.io//</id><title type="html">Your awesome title</title><subtitle>Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
</subtitle><entry><title type="html">Welcome to Jekyll!</title><link href="https://smpeters.github.io/jekyll/update/2016/12/29/welcome-to-jekyll.html" rel="alternate" type="text/html" title="Welcome to Jekyll!" /><published>2016-12-29T20:09:14-06:00</published><updated>2016-12-29T20:09:14-06:00</updated><id>https://smpeters.github.io/jekyll/update/2016/12/29/welcome-to-jekyll</id><content type="html" xml:base="https://smpeters.github.io/jekyll/update/2016/12/29/welcome-to-jekyll.html"><p>You’ll find this post in your <code class="highlighter-rouge">_posts</code> directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run <code class="highlighter-rouge">jekyll serve</code>, which launches a web server and auto-regenerates your site when a file is updated.</p>
<p>To add new posts, simply add a file in the <code class="highlighter-rouge">_posts</code> directory that follows the convention <code class="highlighter-rouge">YYYY-MM-DD-name-of-post.ext</code> and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.</p>
<p>Jekyll also offers powerful support for code snippets:</p>
<figure class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="k">def</span> <span class="nf">print_hi</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
<span class="nb">puts</span> <span class="s2">"Hi, </span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2">"</span>
<span class="k">end</span>
<span class="n">print_hi</span><span class="p">(</span><span class="s1">'Tom'</span><span class="p">)</span>
<span class="c1">#=&gt; prints 'Hi, Tom' to STDOUT.</span></code></pre></figure>
<p>Check out the <a href="http://jekyllrb.com/docs/home">Jekyll docs</a> for more info on how to get the most out of Jekyll. File all bugs/feature requests at <a href="https://github.com/jekyll/jekyll">Jekyll’s GitHub repo</a>. If you have questions, you can ask them on <a href="https://talk.jekyllrb.com/">Jekyll Talk</a>.</p></content><summary type="html">You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.</summary></entry><entry><title type="html">Touchingo</title><link href="https://smpeters.github.io/jekyll/update/2016/12/29/touchingo.html" rel="alternate" type="text/html" title="Touchingo" /><published>2016-12-29T20:09:14-06:00</published><updated>2016-12-29T20:09:14-06:00</updated><id>https://smpeters.github.io/jekyll/update/2016/12/29/touchingo</id><content type="html" xml:base="https://smpeters.github.io/jekyll/update/2016/12/29/touchingo.html"><p>I’ve been meaning to look more deeply at Go for a while and thought I’d finally sit down and do it. When I try to learn a new language, I go through a few different exercises to try to learn it. I go through the standard “Hello, world!” programs, but rather than usually following to closely to what a book is doing, I like to head off on my own, then come back to a book to help fill in the details. In trying to learn Go, I thought I’d try to approach it from the standpoint of a system language since it’s compiled and should be reasonably running at C speeds. One of the things I try to do is rebuild the touch command on UNIX. With a bit of poking around on the os package for go, I got this simple example working.</p>
<figure class="highlight"><pre><code class="language-go" data-lang="go"><span class="k">package</span><span class="x"> </span><span class="n">main</span><span class="x">
</span><span class="k">import</span><span class="x"> </span><span class="s">"os"</span><span class="x">
</span><span class="k">import</span><span class="x"> </span><span class="s">"time"</span><span class="x">
</span><span class="k">func</span><span class="x"> </span><span class="n">main</span><span class="p">()</span><span class="x"> </span><span class="p">{</span><span class="x">
</span><span class="n">err</span><span class="x"> </span><span class="o">:=</span><span class="x"> </span><span class="n">os</span><span class="o">.</span><span class="n">Chtimes</span><span class="p">(</span><span class="s">"foo"</span><span class="p">,</span><span class="x"> </span><span class="n">time</span><span class="o">.</span><span class="n">Now</span><span class="p">(),</span><span class="x"> </span><span class="n">time</span><span class="o">.</span><span class="n">Now</span><span class="p">());</span><span class="x">
</span><span class="k">if</span><span class="x"> </span><span class="n">err</span><span class="x"> </span><span class="o">!=</span><span class="x"> </span><span class="no">nil</span><span class="x"> </span><span class="p">{</span><span class="x">
</span><span class="n">file</span><span class="p">,</span><span class="x"> </span><span class="n">err</span><span class="x"> </span><span class="o">:=</span><span class="x"> </span><span class="n">os</span><span class="o">.</span><span class="n">Create</span><span class="p">(</span><span class="s">"foo"</span><span class="p">)</span><span class="x">
</span><span class="k">if</span><span class="x"> </span><span class="n">err</span><span class="x"> </span><span class="o">!=</span><span class="x"> </span><span class="no">nil</span><span class="x"> </span><span class="p">{</span><span class="x">
</span><span class="nb">panic</span><span class="p">(</span><span class="n">err</span><span class="p">)</span><span class="x">
</span><span class="p">}</span><span class="x">
</span><span class="n">file</span><span class="o">.</span><span class="n">Close</span><span class="p">()</span><span class="x">
</span><span class="p">}</span><span class="x">
</span><span class="p">}</span></code></pre></figure>
<p>There’s a lot of problems here. The biggest problem is that the file is hard-coded to “foo”. I obviously need to change this to get the file from the command line. Second, I’m not really happy with the error handling here. While this probably works, it’s not really specific so I’m guessing this fail in some weird and unexpected ways.</p>
<p>A little more playing around I came up with the following which is a bit more Go like.</p>
<figure class="highlight"><pre><code class="language-go" data-lang="go"><span class="k">package</span><span class="x"> </span><span class="n">main</span><span class="x">
</span><span class="k">import</span><span class="x"> </span><span class="s">"os"</span><span class="x">
</span><span class="k">import</span><span class="x"> </span><span class="s">"time"</span><span class="x">
</span><span class="k">func</span><span class="x"> </span><span class="n">main</span><span class="p">()</span><span class="x"> </span><span class="p">{</span><span class="x">
</span><span class="n">args</span><span class="x"> </span><span class="o">:=</span><span class="x"> </span><span class="n">os</span><span class="o">.</span><span class="n">Args</span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="p">]</span><span class="x">
</span><span class="k">if</span><span class="x"> </span><span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="x"> </span><span class="o">!=</span><span class="x"> </span><span class="m">1</span><span class="x"> </span><span class="p">{</span><span class="x">
</span><span class="nb">panic</span><span class="p">(</span><span class="s">"Please include a filename"</span><span class="p">)</span><span class="x">
</span><span class="p">}</span><span class="x">
</span><span class="n">filename</span><span class="x"> </span><span class="o">:=</span><span class="x"> </span><span class="n">args</span><span class="p">[</span><span class="m">0</span><span class="p">]</span><span class="x">
</span><span class="k">if</span><span class="x"> </span><span class="n">err</span><span class="x"> </span><span class="o">:=</span><span class="x"> </span><span class="n">os</span><span class="o">.</span><span class="n">Chtimes</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span><span class="x"> </span><span class="n">time</span><span class="o">.</span><span class="n">Now</span><span class="p">(),</span><span class="x"> </span><span class="n">time</span><span class="o">.</span><span class="n">Now</span><span class="p">());</span><span class="x"> </span><span class="n">os</span><span class="o">.</span><span class="n">IsNotExist</span><span class="p">(</span><span class="n">err</span><span class="p">)</span><span class="x"> </span><span class="p">{</span><span class="x">
</span><span class="k">if</span><span class="x"> </span><span class="n">_</span><span class="p">,</span><span class="x"> </span><span class="n">err</span><span class="x"> </span><span class="o">:=</span><span class="x"> </span><span class="n">os</span><span class="o">.</span><span class="n">Create</span><span class="p">(</span><span class="n">filename</span><span class="p">);</span><span class="x"> </span><span class="n">err</span><span class="x"> </span><span class="o">!=</span><span class="x"> </span><span class="no">nil</span><span class="x"> </span><span class="p">{</span><span class="x">
</span><span class="nb">panic</span><span class="p">(</span><span class="n">err</span><span class="p">)</span><span class="x">
</span><span class="p">}</span><span class="x">
</span><span class="p">}</span><span class="x">
</span><span class="p">}</span></code></pre></figure>
<p>OK, that’s better and a bit more go-like. We’re expecting a filename, and, if we don’t get it, the program exits with an error. Then, the program tries to update the times. If that fails because the file doesn’t exist, it creates one.</p>
<p>The actual version of thouch has command-line arguments that provide a lot of different bits of functionality. I think for getting started, this version is good enough. I’ll have to revisit this all again in a later post.</p></content><summary type="html">I’ve been meaning to look more deeply at Go for a while and thought I’d finally sit down and do it. When I try to learn a new language, I go through a few different exercises to try to learn it. I go through the standard “Hello, world!” programs, but rather than usually following to closely to what a book is doing, I like to head off on my own, then come back to a book to help fill in the details. In trying to learn Go, I thought I’d try to approach it from the standpoint of a system language since it’s compiled and should be reasonably running at C speeds. One of the things I try to do is rebuild the touch command on UNIX. With a bit of poking around on the os package for go, I got this simple example working.</summary></entry></feed>