Skip to content

Commit

Permalink
Merge pull request #1 from silshack/gh-pages
Browse files Browse the repository at this point in the history
Pull in changes from silshack
  • Loading branch information
erholmes committed Sep 4, 2013
2 parents 31f7baa + 4001b76 commit 8a82e1f
Show file tree
Hide file tree
Showing 33 changed files with 867 additions and 451 deletions.
10 changes: 5 additions & 5 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: The SILShack class blog - Fall 2013
pygments: false
pygments: true
markdown: redcarpet

baseurl: /fall2013
Expand Down Expand Up @@ -84,14 +84,14 @@ authors:
github: landongrindheim
twitter: landongrindheim
about: Landon is an MSIS student at UNC Chapel Hill. He grew up in North Dakota, but has lived in Idaho, Montana and North Carolina as well as in the Middle East. His brain operates primarily in the humanities.
aharding:
name: Alexander Harold
alexharding:
name: Alexander Harding
prof: false
gravatar:
website:
github:
github: alexharding
twitter:
about:
about: Alex is a second year MSIS student at SILS and the bottom of the totem pole in the UNC Libraries IT Systems department. He looks forward to working with everyone in this class!
lho:
name: Leslie Ho
prof: false
Expand Down
7 changes: 7 additions & 0 deletions _posts/2013-08-26-alex-post.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout: post
author: alexharding
categories: post
---

**WOW!** I made a post.
15 changes: 0 additions & 15 deletions _posts/2013-08-26-christophers-post.md

This file was deleted.

2 changes: 1 addition & 1 deletion _posts/2013-08-28-third-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Wednesday Aug 28th Readings:

- [x] In-Class Exercise: Close your first pull request

- [ ] In-Class: Pair up with your merging partner.
- [x] In-Class: Pair up with your merging partner.

- [ ] In-Class: Set up VirtualBox Ubuntu. Extra credit for helping peers install outside of class. This is due by the end of the week. Post to our Google community if you're having trouble setting it up and someone will help you out.
118 changes: 118 additions & 0 deletions _posts/2013-09-01-Daves-post.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
title: Example for the Sept. 4th Class
layout: post
author: dpcolar
categories: post code
---

To add to the discussion for Wednesday's class, I wrote a few example lines of C and dumped the assembler code.
It is interesting to see where the compiler generated the same machine code for different instructions.

C code

```
#include <stdio.h>
main () {
int number; /* Declare an integer variable */
number = 0;
int one;
one = 1;
char c_one[2] = "01";
char single[1] = "1";
while (number < 10) {
printf("%d \n", number);
number++;
number += 1;
number = number + 1;
number = number + one;
number = atoi(c_one);
}
}
```

Assember output via: <br>
gcc -S -o example.s example.c <br>
as -aljnd example.s > example.txt

```
.file "example.c"
.section .rodata
.LC0:
.string "%d \n"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushl %ebp The initial value for %ebp is usually 0.
This is so debuggers know when to end following the link chain in a backtrace.
Think of %ebp as a reference point.
For convenience, it is placed between the function arguments and local variables.
That way, you access arguments with a positive offset, and variables with a negative offset.
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp %esp - Stack Pointer
This register is implicitly manipulated by several CPU instructions
(PUSH, POP, CALL, and RET among others), it always points to the last element
used on the stack.
.cfi_def_cfa_register 5
andl $-16, %esp
subl $32, %esp
movl $0, 24(%esp) number = 0;
movl $1, 28(%esp) one = 1;
movw $12592, 22(%esp) move one word (2 bytes) containing the characters "01"
"0" is 00110000 00000000 = 12288 (dec)
"1" is 00000001 00110000 = 304 (dec)
movb $49, 21(%esp) move one byte containing ASCII 49
jmp .L2 Jump the the marker .L2
.L3:
movl 24(%esp), %eax set up the parameters for printf
movl %eax, 4(%esp)
movl $.LC0, (%esp)
call printf
Note: compiler generates the same machine instructions
addl $1, 24(%esp) number++;
addl $1, 24(%esp) number += 1;
addl $1, 24(%esp) number = number + 1;
movl 28(%esp), %eax move 'one'
addl %eax, 24(%esp) add it to 'number'
leal 22(%esp), %eax Load effective address of 'c_one'
movl %eax, (%esp) change the stack pointer the the address of 'c_one'
call atoi convert a string to integer
iterate through the characters of the string from left to right,
updating an accumulator with the growing integer value. Initially, the accumulator is set to 0.
At each character c, you multiply the accumulator by 10, and then add to it the value of the digit c
movl %eax, 24(%esp) move the result back to 'number'
.L2:
"while (number < 10) {"
cmpl $9, 24(%esp) Compares two integers. It does this by subtracting the first operand from the second
jle .L3 jump to .L3 if number < or = 9
leave The compiler uses this instruction to free the used space by the function in the stack.
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3"
.section .note.GNU-stack,"",@progbits
```

References:<br>
http://stackoverflow.com/questions/8361942/assembly-registers-esp-and-ebp
http://download.intel.com/products/processor/manual/325462.pdf
http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html
12 changes: 12 additions & 0 deletions _posts/2013-09-03-christophers-post.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: post
author: IAMATinyCoder
categories: announcement
---

## Python Syntax Highlighting

```python
s = "Python syntax highlighting"
print s
```
41 changes: 41 additions & 0 deletions _posts/2013-09-04-fourth-class.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
layout: post
author: elliott
category: notes
title: Fourth Class Notes
---

### Github Exercise: Update authorname
- Pull from Silshack
- Update author name, respecting spaces
- Compare & review
- Pull request

### Git Branching
- [Learn Git Branching](http://pcottle.github.io/learnGitBranching/) Demo
- Jaleesa's getting a file one one branch to the pull request.

### Check in: Ubuntu installation
- Feelings
- Thoughts
- Next Steps
- Fire up Python

### Assembler to Machine Language
- Machine = processor
- Virtual Machine = virtual processor
- Errors in processor architecture
- Dave's post
- Python interpreted code

### In Class Python Exercise
- Comments or questions from the reading?
- Use Ubuntu's terminal if you have it. Otherwise, use [Skulpt](http://www.skulpt.org/)

print "Hello World"
1 + 1
4 * 2
5 / 3

### For Monday
- Check out the [Interactive Version](http://interactivepython.org/courselib/static/thinkcspy/toc.html) of our book! Just found this.
12 changes: 0 additions & 12 deletions _site/2013/08/26/marys-post.html

This file was deleted.

28 changes: 14 additions & 14 deletions _site/2013/08/28/codefromerinc.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ <h2>Some code from Erin C.</h2>
<p class="meta">28 Aug 2013</p>

<div class="post">
<div class="highlight"><pre><code class="javascript language-javascript" data-lang="javascript">function myFunction()
{
var x=&quot;&quot;;
var time=new Date().getHours();
if (time&lt;20)
{
x=&quot;Good day&quot;;
}
else
{
x=&quot;Good evening&quot;;
}
document.getElementById(&quot;demo&quot;).innerHTML=x;
}
<div class="highlight"><pre><code class="javascript language-javascript" data-lang="javascript"><span class="kd">function</span> <span class="nx">myFunction</span><span class="p">()</span>
<span class="p">{</span>
<span class="kd">var</span> <span class="nx">x</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">time</span><span class="o">=</span><span class="k">new</span> <span class="nb">Date</span><span class="p">().</span><span class="nx">getHours</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">time</span><span class="o">&lt;</span><span class="mi">20</span><span class="p">)</span>
<span class="p">{</span>
<span class="nx">x</span><span class="o">=</span><span class="s2">&quot;Good day&quot;</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">else</span>
<span class="p">{</span>
<span class="nx">x</span><span class="o">=</span><span class="s2">&quot;Good evening&quot;</span><span class="p">;</span>
<span class="p">}</span>
<span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">&quot;demo&quot;</span><span class="p">).</span><span class="nx">innerHTML</span><span class="o">=</span><span class="nx">x</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,20 @@ <h1 class="title"><a href="/fall2013/">The SILShack class blog - Fall 2013</a></
<h2>Christophers Post</h2>

<p>
by Christopher Kenrick
by
</p> <!-- /.byline -->

<p class="meta">26 Aug 2013</p>
<p class="meta">03 Sep 2013</p>

<div class="post">
<h2>Top of new post</h2>
<div class="highlight"><pre><code class="text language-text" data-lang="text">function fancyAlert(arg) {
if(arg) {
$.facebox({div:'#foo'})
}
}
<h2>Python Syntax Highlighting</h2>
<div class="highlight"><pre><code class="python language-python" data-lang="python"><span class="n">s</span> <span class="o">=</span> <span class="s">&quot;Python syntax highlighting&quot;</span>
<span class="k">print</span> <span class="n">s</span>
</code></pre></div>
</div>

<div class="end">
Christopher is a dual-degree student studying Information Science and Public Administration. Find Christopher Kenrick on <a href="http://twitter.com/ChrisKenrick">Twitter</a>, <a href="http://github.com/IAMATinyCoder">Github</a>, and <a href="">on the web</a>.
Find on <a href="http://twitter.com/">Twitter</a>, <a href="http://github.com/">Github</a>, and <a href="">on the web</a>.
</div>

<div id="disqus_thread"></div>
Expand Down
2 changes: 1 addition & 1 deletion _site/announcements/2013/08/28/third-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ <h3>Left over from last time: How Jekyll works</h3>
<li><p><code>*.markdown</code>: Pages for the site</p></li>
<li><p>[x] In-Class Exercise: Open your first pull request</p></li>
<li><p>[x] In-Class Exercise: Close your first pull request</p></li>
<li><p>[ ] In-Class: Pair up with your merging partner.</p></li>
<li><p>[x] In-Class: Pair up with your merging partner.</p></li>
<li><p>[ ] In-Class: Set up VirtualBox Ubuntu. Extra credit for helping peers install outside of class. This is due by the end of the week. Post to our Google community if you&#39;re having trouble setting it up and someone will help you out.</p></li>
</ul>

Expand Down
40 changes: 20 additions & 20 deletions _site/gmclendon/2013/08/28/grants-Second-post.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,26 @@ <h2>Grant shows some syntax highlighting</h2>

<div class="post">
<p>Here&#39;s some python from <a href="https://github.com/twilio/twilio-python">this project</a> just to show off syntax highlighting.</p>
<div class="highlight"><pre><code class="python language-python" data-lang="python">class ApplicationsTest(unittest.TestCase):
def setUp(self):
self.parent = Mock()
self.resource = Applications(&quot;http://api.twilio.com&quot;, (&quot;user&quot;, &quot;pass&quot;))

def test_create_appliation_sms_url_method(self):
self.resource.create_instance = Mock()
self.resource.create(sms_method=&quot;hey&quot;)
self.resource.create_instance.assert_called_with({&quot;sms_method&quot;: &quot;hey&quot;})

def test_create_appliation_sms_url(self):
self.resource.create_instance = Mock()
self.resource.create(sms_url=&quot;hey&quot;)
self.resource.create_instance.assert_called_with({&quot;sms_url&quot;: &quot;hey&quot;})

def test_update_appliation_sms_url_method(self):
self.resource.update_instance = Mock()
self.resource.update(&quot;123&quot;, sms_method=&quot;hey&quot;)
self.resource.update_instance.assert_called_with(
&quot;123&quot;, {&quot;sms_method&quot;: &quot;hey&quot;})
<div class="highlight"><pre><code class="python language-python" data-lang="python"><span class="k">class</span> <span class="nc">ApplicationsTest</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">resource</span> <span class="o">=</span> <span class="n">Applications</span><span class="p">(</span><span class="s">&quot;http://api.twilio.com&quot;</span><span class="p">,</span> <span class="p">(</span><span class="s">&quot;user&quot;</span><span class="p">,</span> <span class="s">&quot;pass&quot;</span><span class="p">))</span>

<span class="k">def</span> <span class="nf">test_create_appliation_sms_url_method</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">resource</span><span class="o">.</span><span class="n">create_instance</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">resource</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">sms_method</span><span class="o">=</span><span class="s">&quot;hey&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">resource</span><span class="o">.</span><span class="n">create_instance</span><span class="o">.</span><span class="n">assert_called_with</span><span class="p">({</span><span class="s">&quot;sms_method&quot;</span><span class="p">:</span> <span class="s">&quot;hey&quot;</span><span class="p">})</span>

<span class="k">def</span> <span class="nf">test_create_appliation_sms_url</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">resource</span><span class="o">.</span><span class="n">create_instance</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">resource</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">sms_url</span><span class="o">=</span><span class="s">&quot;hey&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">resource</span><span class="o">.</span><span class="n">create_instance</span><span class="o">.</span><span class="n">assert_called_with</span><span class="p">({</span><span class="s">&quot;sms_url&quot;</span><span class="p">:</span> <span class="s">&quot;hey&quot;</span><span class="p">})</span>

<span class="k">def</span> <span class="nf">test_update_appliation_sms_url_method</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">resource</span><span class="o">.</span><span class="n">update_instance</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">resource</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="s">&quot;123&quot;</span><span class="p">,</span> <span class="n">sms_method</span><span class="o">=</span><span class="s">&quot;hey&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">resource</span><span class="o">.</span><span class="n">update_instance</span><span class="o">.</span><span class="n">assert_called_with</span><span class="p">(</span>
<span class="s">&quot;123&quot;</span><span class="p">,</span> <span class="p">{</span><span class="s">&quot;sms_method&quot;</span><span class="p">:</span> <span class="s">&quot;hey&quot;</span><span class="p">})</span>
</code></pre></div>
<p>ain&#39;t it pretty.</p>

Expand Down
Loading

0 comments on commit 8a82e1f

Please sign in to comment.