From 3d1b09c628b58f8bc9f9c76682d3d78885ae6376 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Sun, 9 Dec 2018 12:43:06 -0500 Subject: Initial commit --- src/css/bootstrap.css | 1 + src/css/styles.css | 58 ++++++++++++++++++++++ src/html/bread.html | 99 +++++++++++++++++++++++++++++++++++++ src/html/essay.html | 25 ++++++++++ src/html/essay/magic-division.html | 95 +++++++++++++++++++++++++++++++++++ src/html/index.html | 29 +++++++++++ src/index.js | 4 ++ src/photo/ban1.jpg | Bin 0 -> 1106159 bytes src/photo/ban2.jpg | Bin 0 -> 1411456 bytes src/photo/cider.jpg | Bin 0 -> 725680 bytes src/photo/first-1.jpg | Bin 0 -> 283944 bytes src/photo/first-2.jpg | Bin 0 -> 296466 bytes src/photo/flat1.jpg | Bin 0 -> 1129498 bytes src/photo/flat2.jpg | Bin 0 -> 905668 bytes src/photo/nyt1.jpg | Bin 0 -> 2142167 bytes src/photo/nyt2.jpg | Bin 0 -> 1286502 bytes src/photo/wheat.jpg | Bin 0 -> 2669180 bytes src/photo/white-1.jpg | Bin 0 -> 1652366 bytes src/photo/white-2.jpg | Bin 0 -> 1811909 bytes src/server.js | 33 +++++++++++++ 20 files changed, 344 insertions(+) create mode 120000 src/css/bootstrap.css create mode 100644 src/css/styles.css create mode 100644 src/html/bread.html create mode 100644 src/html/essay.html create mode 100644 src/html/essay/magic-division.html create mode 100644 src/html/index.html create mode 100644 src/index.js create mode 100644 src/photo/ban1.jpg create mode 100644 src/photo/ban2.jpg create mode 100644 src/photo/cider.jpg create mode 100644 src/photo/first-1.jpg create mode 100644 src/photo/first-2.jpg create mode 100644 src/photo/flat1.jpg create mode 100644 src/photo/flat2.jpg create mode 100644 src/photo/nyt1.jpg create mode 100644 src/photo/nyt2.jpg create mode 100644 src/photo/wheat.jpg create mode 100644 src/photo/white-1.jpg create mode 100644 src/photo/white-2.jpg create mode 100644 src/server.js (limited to 'src') diff --git a/src/css/bootstrap.css b/src/css/bootstrap.css new file mode 120000 index 0000000..a78be59 --- /dev/null +++ b/src/css/bootstrap.css @@ -0,0 +1 @@ +../../node_modules/bootstrap/dist/css/bootstrap.css \ No newline at end of file diff --git a/src/css/styles.css b/src/css/styles.css new file mode 100644 index 0000000..08a5f38 --- /dev/null +++ b/src/css/styles.css @@ -0,0 +1,58 @@ +body { + padding: 15px; +} + +.essay{ + width: 70%; +} + +.figure { + border: 1px solid #777777; + background-color: #dddddd; + padding: 10px; +} + +.item { + margin: 10px; + border: 2px solid #777777; + border-radius: 5px; + padding: 7px; +} + +img { + image-orientation: from-image; +} + +.card img { + width: 80%; + display: block; + margin-left: auto; + margin-right: auto; + margin-top: 2em; +} + +.sidebar { + height: 100vh; + width: 15%; + margin: 20px; +} + +.sidebar ul { + list-style: none; + padding: 0; +} + +.sidebar ul li { + display: block; + margin: 5px; + margin-left: auto; + margin-right: auto; +} + +.btn-primary { + width: 100%; + height: 2em; + border-radius: 0; + text-align: center; + font-size: 20px; +} diff --git a/src/html/bread.html b/src/html/bread.html new file mode 100644 index 0000000..af2a665 --- /dev/null +++ b/src/html/bread.html @@ -0,0 +1,99 @@ + + + + Mark's Kitchen - Bread + + + + + + +
+
+

Bread

+
+
+
+
+

First sourdough, mainly wheat

+ + +
+

Aug 9, 2018

+
+
+
+
+
+
+

Used more white flour this time

+ + +
+

Aug 16, 2018

+
+
+
+
+
+
+
+
+

Severely messed up the recipie this time. Tried to double to get two loafs, both turned out flat.

+ + +
+

Aug 30, 2018

+
+
+
+
+
+
+

First time using a banneton, beautiful shape. Tried a different knead style too. Rye-AP mix

+ + +
+

Sep 19, 2018

+
+
+
+
+
+
+
+
+

I wanted to try the NY Times no knead recipie. Bread turned out delicious. Will try to tranfer to a loaf shape next time for slices.

+ + +
+

Sep 27, 2018

+
+
+
+
+
+
+

A twist on normal beer bread, using hard cider.

+ +
+

Sep 30, 2018

+
+
+
+
+
+
+
+
+

Tried to make something more sandwich-y. 4 hour warm proof with wheat, rye, and corn flours. A bit dense, but not bad.

+ +
+

Sep 30, 2018

+
+
+
+
+
+ + diff --git a/src/html/essay.html b/src/html/essay.html new file mode 100644 index 0000000..a3e88e1 --- /dev/null +++ b/src/html/essay.html @@ -0,0 +1,25 @@ + + + + Mark's Kitchen - Essay + + + + + + +
+
+

Essay

+
+
+

+ When digging through generated assembly code, some strange numbers showed + up. This essay briefly explains what was going on. +

+ Read +
+
+
+ + diff --git a/src/html/essay/magic-division.html b/src/html/essay/magic-division.html new file mode 100644 index 0000000..f40048d --- /dev/null +++ b/src/html/essay/magic-division.html @@ -0,0 +1,95 @@ + + + + Magic Division + + + + + + +
+

Magic Division -- Or Division by Integer Multiplication

+ +

I noticed something strange in the assembly generated when compiling a program + using gcc an optimization turned off. Here it is in Figure 1 + (though using optimization level 3 just to simplify, but it still shows in level 0). + In this generated assembly, we see instead of using the div operator, + something strange is going on with the number 1717986919 and shifting. My first + attempts at searching for this phenomenon online were not helpful. The first result + for the number was on Amazon as a book identifier. This number also shows up on + stack overflow, however it is no more helpful. No one on the post is talking about + why this number is in the generated code (or perhaps they all know this arcane + secret and don’t wish share). Eventually, I found out what was going on. Even + with no optimization, the compiler prefers to generate multiplication operator + over the division operator. +

+

We will consider unsigned integer division first. Let + d + be some constant divisor, and n + our numerator (for now let’s make n + a multiple of d). We will assume + integers are 32 bits. In order to computer + n/d, + first we need to know the values l + and i where + d = l2i. + So to begin out division, we can shift n + by i bits. Now we must divide this result + be l. Since + l will be odd, there exists some + inverse of l, called + j where
+ lj = 1(mod 232)
+ So for any number x, + x/l = (xj)/(lj)=xj. + So now all that is left after the shift is to multiply by + j, and we will + have computed n/d.

+

Dealing with remainder can go pretty in depth, and I recommend + reading the chapter in Hacker’s Delight about this topic + [1]. Another write up can be found + in the MSDN blog archive [2]. +

+ +
+

Figure 1

+ Source: +
+

+int div20(int n){
+    return a/20;
+}
+        
+ Compiled excerpt: +
+

+.cfi_startproc
+movl    %edi, %eax
+movl    $1717986919, %edx
+sarl    $31, %edi
+imull   %edx
+sarl    $3, %edx
+movl    %edx, %eax
+subl    %edi, %eax
+ret
+.cfi_endproc
+        
+
+ +

References

+

1 Hacker’s Delight Chapter 10. + ( + http://www.hackersdelight.org/divcMore.pdf + + ) +

+

2 MSDN Blog Archive + ( + https://blogs.msdn.microsoft.com/devdev/2005/12/12/integer-division-by-constants/ + + ) +

+
+ + \ No newline at end of file diff --git a/src/html/index.html b/src/html/index.html new file mode 100644 index 0000000..0e15b8c --- /dev/null +++ b/src/html/index.html @@ -0,0 +1,29 @@ + + + + Mark's Kitchen + + + + + + +

Welcome to Mark's Kitchen

+ + +
+
+
+

+ Come check out my gallery of homemade bread, featuring mainly artisan sourdough. +

+
+
+
+ + diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..767acb5 --- /dev/null +++ b/src/index.js @@ -0,0 +1,4 @@ +const server = require('./server'); +server.setUpRoutes(); +server.listen(); + diff --git a/src/photo/ban1.jpg b/src/photo/ban1.jpg new file mode 100644 index 0000000..0330443 Binary files /dev/null and b/src/photo/ban1.jpg differ diff --git a/src/photo/ban2.jpg b/src/photo/ban2.jpg new file mode 100644 index 0000000..f868504 Binary files /dev/null and b/src/photo/ban2.jpg differ diff --git a/src/photo/cider.jpg b/src/photo/cider.jpg new file mode 100644 index 0000000..176a094 Binary files /dev/null and b/src/photo/cider.jpg differ diff --git a/src/photo/first-1.jpg b/src/photo/first-1.jpg new file mode 100644 index 0000000..664acd7 Binary files /dev/null and b/src/photo/first-1.jpg differ diff --git a/src/photo/first-2.jpg b/src/photo/first-2.jpg new file mode 100644 index 0000000..11f2ab7 Binary files /dev/null and b/src/photo/first-2.jpg differ diff --git a/src/photo/flat1.jpg b/src/photo/flat1.jpg new file mode 100644 index 0000000..ff6df1c Binary files /dev/null and b/src/photo/flat1.jpg differ diff --git a/src/photo/flat2.jpg b/src/photo/flat2.jpg new file mode 100644 index 0000000..d07f638 Binary files /dev/null and b/src/photo/flat2.jpg differ diff --git a/src/photo/nyt1.jpg b/src/photo/nyt1.jpg new file mode 100644 index 0000000..a31e79e Binary files /dev/null and b/src/photo/nyt1.jpg differ diff --git a/src/photo/nyt2.jpg b/src/photo/nyt2.jpg new file mode 100644 index 0000000..5c955da Binary files /dev/null and b/src/photo/nyt2.jpg differ diff --git a/src/photo/wheat.jpg b/src/photo/wheat.jpg new file mode 100644 index 0000000..b039eb6 Binary files /dev/null and b/src/photo/wheat.jpg differ diff --git a/src/photo/white-1.jpg b/src/photo/white-1.jpg new file mode 100644 index 0000000..a58d50b Binary files /dev/null and b/src/photo/white-1.jpg differ diff --git a/src/photo/white-2.jpg b/src/photo/white-2.jpg new file mode 100644 index 0000000..87b8343 Binary files /dev/null and b/src/photo/white-2.jpg differ diff --git a/src/server.js b/src/server.js new file mode 100644 index 0000000..e2cfb20 --- /dev/null +++ b/src/server.js @@ -0,0 +1,33 @@ +const express = require('express'); + +const port = 80; + +const server = express(); + +function listen(){ + server.listen(port, () => console.info(`Listening on port ${port}!`)); +} + +function setUpRoutes(){ + server.get('/', (req, res) => res.sendFile(__dirname + "/html/index.html")) + server.get('/bread', (req, res) => res.sendFile(__dirname + "/html/bread.html")); + server.get('/essay', (req, res) => res.sendFile(__dirname + "/html/essay.html")); + + + server.get('/css/:id', (req, res) => { + res.sendFile(__dirname + "/css/"+req.params.id); + }); + server.get('/photo/:id', (req, res) => { + res.sendFile(__dirname + "/photo/"+req.params.id); + }); + server.get('/essay/:id', (req, res) => { + res.sendFile(__dirname + "/html/essay/"+req.params.id); + }); + +} + +module.exports = { + listen, + setUpRoutes +}; + -- cgit v1.2.3