Browse Source

Move to Hugo.

dev
Chris Smith 8 years ago
parent
commit
9a27b62841
81 changed files with 270 additions and 179 deletions
  1. 0
    2
      .gitignore
  2. 0
    1
      CNAME
  3. 1
    0
      Dockerfile
  4. 0
    2
      Gemfile
  5. 0
    14
      _config.yml
  6. 0
    57
      _layouts/default.html
  7. 0
    19
      _layouts/photos.html
  8. 0
    7
      _posts/2016-03-09-testing.md
  9. 21
    0
      docker-compose.dev.yml
  10. 21
    0
      docker-compose.yml
  11. 7
    6
      import-photos.sh
  12. 0
    23
      index.html
  13. 1
    1
      site/LICENCE
  14. 7
    0
      site/config.yaml
  15. 8
    7
      site/content/photos/2013-02-SanFrancisco.md
  16. 20
    0
      site/content/photos/2015-06-London.md
  17. 6
    5
      site/content/photos/2015-08-Maui.md
  18. 13
    12
      site/content/post/2016-04-10-sense-api.md
  19. 13
    12
      site/content/post/2016-05-02-monitoring-power-with-wemo.md
  20. 3
    2
      site/content/post/2016-05-21-docker-automatic-nginx-proxy.md
  21. 3
    0
      site/layouts/_default/single.html
  22. 3
    0
      site/layouts/index.html
  23. 33
    0
      site/layouts/partials/album.html
  24. 5
    9
      site/layouts/partials/article.html
  25. 39
    0
      site/layouts/partials/foot.html
  26. 27
    0
      site/layouts/partials/head.html
  27. 22
    0
      site/layouts/partials/list.html
  28. 14
    0
      site/layouts/partials/pagination.html
  29. 3
    0
      site/layouts/photos/single.html
  30. 0
    0
      site/static/.well-known/keybase.txt
  31. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-01-26 10.14.05.JPG
  32. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-01-27 07.41.59.JPG
  33. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-01-27 07.46.51.JPG
  34. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-01-27 08.41.22.JPG
  35. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-01-27 10.04.37.JPG
  36. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-01-30 20.24.19.JPG
  37. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-01-30 20.37.13.JPG
  38. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-02-01 09.23.46.JPG
  39. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-02-02 10.15.13.JPG
  40. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-02-02 11.46.28.JPG
  41. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-02-02 12.17.03.JPG
  42. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-02-02 12.31.57.JPG
  43. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-02-02 12.46.49.JPG
  44. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-02-03 10.37.02.JPG
  45. 0
    0
      site/static/photos/2013-02-SanFrancisco/2013-02-03 11.03.55.JPG
  46. BIN
      site/static/photos/2015-06-London/P6140016.jpg
  47. BIN
      site/static/photos/2015-06-London/P6140071.jpg
  48. BIN
      site/static/photos/2015-06-London/P6140079.jpg
  49. BIN
      site/static/photos/2015-06-London/P6140109.jpg
  50. 0
    0
      site/static/photos/2015-08-Maui/G0122882.jpg
  51. 0
    0
      site/static/photos/2015-08-Maui/IMG_20150730_070036.jpg
  52. 0
    0
      site/static/photos/2015-08-Maui/IMG_20150731_071026.jpg
  53. 0
    0
      site/static/photos/2015-08-Maui/P7300158.jpg
  54. 0
    0
      site/static/photos/2015-08-Maui/P7300176.jpg
  55. 0
    0
      site/static/photos/2015-08-Maui/P7310186.jpg
  56. 0
    0
      site/static/photos/2015-08-Maui/P7310206.jpg
  57. 0
    0
      site/static/photos/2015-08-Maui/P7310207.jpg
  58. 0
    0
      site/static/photos/2015-08-Maui/P7310220.jpg
  59. 0
    0
      site/static/photos/2015-08-Maui/P7310236.jpg
  60. 0
    0
      site/static/photos/2015-08-Maui/P7310285.jpg
  61. 0
    0
      site/static/photos/2015-08-Maui/PANO_20150729_073240.jpg
  62. 0
    0
      site/static/photos/2015-08-Maui/PANO_20150731_100829.jpg
  63. 0
    0
      site/static/res/css/lightbox.min.css
  64. 0
    0
      site/static/res/css/monokai.css
  65. 0
    0
      site/static/res/css/style.css
  66. 0
    0
      site/static/res/images/background.jpg
  67. 0
    0
      site/static/res/images/close.png
  68. 0
    0
      site/static/res/images/docker/logo.png
  69. 0
    0
      site/static/res/images/docker/logo.thumb.png
  70. 0
    0
      site/static/res/images/docker/reverse-proxy.png
  71. 0
    0
      site/static/res/images/loading.gif
  72. 0
    0
      site/static/res/images/next.png
  73. 0
    0
      site/static/res/images/prev.png
  74. 0
    0
      site/static/res/images/sense/sense.jpg
  75. 0
    0
      site/static/res/images/sense/sense.thumb.jpg
  76. 0
    0
      site/static/res/images/wemo/desk-1d.png
  77. 0
    0
      site/static/res/images/wemo/desk-1w.png
  78. 0
    0
      site/static/res/images/wemo/switch.jpg
  79. 0
    0
      site/static/res/images/wemo/switch.thumb.jpg
  80. 0
    0
      site/static/res/js/lightbox-plus-jquery.min.js
  81. 0
    0
      site/static/res/js/lightbox.min.js

+ 0
- 2
.gitignore View File

@@ -1,2 +0,0 @@
1
-/Gemfile.lock
2
-/_site

+ 0
- 1
CNAME View File

@@ -1 +0,0 @@
1
-www.chameth.com

+ 1
- 0
Dockerfile View File

@@ -0,0 +1 @@
1
+FROM publysher/hugo 

+ 0
- 2
Gemfile View File

@@ -1,2 +0,0 @@
1
-source 'https://rubygems.org'
2
-gem 'github-pages', group: :jekyll_plugins

+ 0
- 14
_config.yml View File

@@ -1,14 +0,0 @@
1
-include: [".well-known"]
2
-gems:
3
-  - jekyll-paginate
4
-  - jekyll-feed
5
-
6
-title: 'Chameth.com'
7
-description: 'Personal Website of Chris Smith'
8
-url: 'https://www.chameth.com'
9
-author: 'Chris Smith'
10
-
11
-paginate: 20
12
-paginate_path: "/posts/page:num/"
13
-
14
-excerpt_separator: "<!--more-->"

+ 0
- 57
_layouts/default.html View File

@@ -1,57 +0,0 @@
1
-<!DOCTYPE html>
2
-<html>
3
-  <head>
4
-    <title>{{page.title}}</title>
5
-    <meta charset="utf-8">
6
-    <link rel="stylesheet" href="/res/css/style.css">
7
-    <link rel="stylesheet" href="/res/css/monokai.css">
8
-    <link rel="stylesheet" href="/res/css/lightbox.min.css">
9
-    {% feed_meta %}
10
-  </head>
11
-  <body>
12
-    <div id="wrapper">
13
-      <div id="main">
14
-        {{content}}
15
-      </div>
16
-
17
-      <section id="sidebar">
18
-        <header>
19
-          <h1><a href="/">Chameth.com</a></h1>
20
-          <p>Personal website of Chris Smith</p>
21
-        </header>
22
-
23
-        <section id="posts">
24
-          <h2>Latest posts</h2>
25
-          {% for post in site.posts limit:3 %}
26
-            <article class="mini-post">
27
-              <header>
28
-                <h3><a href="{{ post.url }}">{{ post.title }}</a></h3>
29
-              </header>
30
-              <a href="{{ post.url }}" class="image"><img src="{{ post.thumbnail }}" alt="{{ post.title }}"></a>
31
-            </article>
32
-          {% endfor %}
33
-        </section>
34
-
35
-        <section id="photos">
36
-          <h2>Recent albums</h2>
37
-          <article class="mini-post">
38
-            <header>
39
-              <h3><a href="/photos/2015-08-Maui/">Maui, Hawaii, USA</a></h3>
40
-              <time class="published" datetime="2015-08-01">August 2015</time>
41
-            </header>
42
-            <a href="/photos/2015-08-Maui/" class="image"><img src="/photos/2015-08-Maui/G0122882.jpg" alt="Turtle in blue water"></a>
43
-          </article>
44
-
45
-          <article class="mini-post">
46
-            <header>
47
-              <h3><a href="/photos/2013-02-SanFrancisco/">San Francisco, CA, USA</a></h3>
48
-              <time class="published" datetime="2013-02-01">February 2013</time>
49
-            </header>
50
-            <a href="/photos/2013-02-SanFrancisco/" class="image"><img src="/photos/2013-02-SanFrancisco/2013-02-02%2011.46.28.JPG" alt="The Golden Gate Bridge"></a>
51
-          </article>
52
-        </section>
53
-      </section>
54
-    </div>
55
-    <script src="/res/js/lightbox-plus-jquery.min.js"></script>
56
-  </body>
57
-</html>

+ 0
- 19
_layouts/photos.html View File

@@ -1,19 +0,0 @@
1
----
2
-layout: default
3
----
4
-<article class="post">
5
-  <header>
6
-    <div class="title">
7
-      <h2>{{ page.album_title }}</h2>
8
-      <p>{{ page.album_date }}</p>
9
-    </div>
10
-  </header>
11
-  {% for photo in page.photos %}
12
-    <a href="{{page.path | replace:'photos/','https://photos.chameth.com/' | replace:'index.html',photo.file}}"
13
-       class="image gallery"
14
-       data-lightbox="gallery"
15
-       data-title="{{photo.caption|xml_escape}}">
16
-      <img src="{{ photo.file }}" alt="{{photo.alt|xml_escape}}">
17
-    </a>
18
-  {% endfor %}
19
-</article>

+ 0
- 7
_posts/2016-03-09-testing.md View File

@@ -1,7 +0,0 @@
1
----
2
-layout: post
3
-title: Coming soon, maybe.
4
-strapline: This is a work in progress.
5
----
6
-
7
-```<!-- TODO -->```

+ 21
- 0
docker-compose.dev.yml View File

@@ -0,0 +1,21 @@
1
+---
2
+
3
+version: '2'
4
+
5
+services:
6
+
7
+  hugo:
8
+    build: .
9
+    restart: always
10
+    labels:
11
+      com.chameth.vhost: 'dev.chameth.com'
12
+      com.chameth.proxy: '1313'
13
+    command:
14
+      - hugo
15
+      - server
16
+      - --bind=0.0.0.0
17
+      - --port=1313
18
+      - --baseURL=https://dev.chameth.com/
19
+      - --appendPort=false
20
+      - --disableLiveReload
21
+      - --log

+ 21
- 0
docker-compose.yml View File

@@ -0,0 +1,21 @@
1
+---
2
+
3
+version: '2'
4
+
5
+services:
6
+
7
+  hugo:
8
+    build: .
9
+    restart: always
10
+    labels:
11
+      com.chameth.vhost: 'chameth.com,www.chameth.com'
12
+      com.chameth.proxy: '1313'
13
+    command:
14
+      - hugo
15
+      - server
16
+      - --bind=0.0.0.0
17
+      - --port=1313
18
+      - --baseURL=https://www.chameth.com/
19
+      - --appendPort=false
20
+      - --disableLiveReload
21
+      - --log

+ 7
- 6
import-photos.sh View File

@@ -2,10 +2,11 @@
2 2
 
3 3
 SOURCE=~/Dropbox/photos-site
4 4
 TEMPLATE='---
5
-layout: photos
6 5
 album_title: XXX
7 6
 album_date: YYY
8
-title: Photos of XXX — YYY · Chameth.com
7
+date: YYYY-MM-DD
8
+title: Photos of XXX — YYY
9
+url: /photos/$foldername/
9 10
 photos:
10 11
 $PHOTOS
11 12
 ---'
@@ -18,12 +19,12 @@ for folder in $SOURCE/*; do
18 19
 
19 20
     for file in $folder/*; do
20 21
         filename=${file##*/}
21
-        out="photos/$foldername/$filename";
22
+        out="site/static/photos/$foldername/$filename";
22 23
         test -e "$out" || convert -thumbnail 400^ -gravity center -crop 400x200+0+0 -strip -quality 86 "$file" "$out";
23 24
     done
24 25
 
25
-    if [ ! -e "photos/$foldername/index.html" ]; then
26
-        export PHOTOS=$(find "photos/$foldername" -type f -printf "$PHOTO_PRINTF")
27
-        envsubst <<< "$TEMPLATE" > "photos/$foldername/index.html"
26
+    if [ ! -e "site/content/photos/$foldername.html" ]; then
27
+        export PHOTOS=$(find "site/static/photos/$foldername" -type f -printf "$PHOTO_PRINTF")
28
+        envsubst <<< "$TEMPLATE" > "site/content/photos/$foldername.html"
28 29
     fi
29 30
 done

+ 0
- 23
index.html View File

@@ -1,23 +0,0 @@
1
----
2
-layout: default
3
-title: Chameth.com — Chris Smith
4
----
5
-{% for post in paginator.posts %}
6
-<article class="post">
7
-  <header>
8
-    <div class="title">
9
-      <h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
10
-      <p>{{ post.strapline }}</p>
11
-    </div>
12
-  </header>
13
-  {{ post.excerpt }}
14
-  <footer>
15
-    <ul>
16
-      <li><a href="{{ post.url }}">Read more</a></li>
17
-      <li><a href="{{ post.url }}#disqus_thread" class="comments"></a></li>
18
-    </ul>
19
-  </footer>
20
-</article>
21
-{% endfor %}
22
-
23
-<script id="dsq-count-scr" src="//chameth.disqus.com/count.js" async></script>

LICENCE → site/LICENCE View File

@@ -1,4 +1,4 @@
1
-Lightbox files (res/*/*lightbox*, and res/images/{close,loading,next,prev}.*):
1
+Lightbox files (static/res/*/*lightbox*, and static/res/images/{close,loading,next,prev}.*):
2 2
 
3 3
   The MIT License (MIT)
4 4
 

+ 7
- 0
site/config.yaml View File

@@ -0,0 +1,7 @@
1
+baseurl: https://www.chameth.com
2
+disablePathToLower: true
3
+languageCode: en-gb
4
+title: Chameth.com
5
+
6
+pygmentsuseclasses: true
7
+...

photos/2013-02-SanFrancisco/index.html → site/content/photos/2013-02-SanFrancisco.md View File

@@ -1,9 +1,13 @@
1 1
 ---
2
-layout: photos
3
-album_title: San Francisco, California, USA
4
-album_date: January and Feburary 2013
5
-title: Photos of San Francisco — February 2013 · Chameth.com
2
+album_title: San Francisco, CA, USA
3
+album_date: January and February 2013
4
+date: 2013-02-01
5
+title: Photos of San Francisco — February 2013
6
+url: /photos/2013-02-SanFrancisco/
6 7
 photos:
8
+- file: 2013-02-02 11.46.28.JPG
9
+  alt: Golden Gate Bridge
10
+  caption: The Golden Gate Bridge. The fog lifted pretty suddenly after this.
7 11
 - file: 2013-02-03 11.03.55.JPG
8 12
   alt: AT&T Park
9 13
   caption: ♫ Take me to the ball game...
@@ -22,9 +26,6 @@ photos:
22 26
 - file: 2013-01-30 20.37.13.JPG
23 27
   alt: "'San Francisco' lit up in neon"
24 28
   caption: Ah, so that's where I was.
25
-- file: 2013-02-02 11.46.28.JPG
26
-  alt: Golden Gate Bridge
27
-  caption: The Golden Gate Bridge. The fog lifted pretty suddenly after this.
28 29
 - file: 2013-01-27 07.46.51.JPG
29 30
   alt: Silhouette of a pier against a yellow sky.
30 31
   caption: One of SF's many piers.

+ 20
- 0
site/content/photos/2015-06-London.md View File

@@ -0,0 +1,20 @@
1
+---
2
+album_title: London, UK
3
+album_date: June 2015
4
+date: 2015-06-01
5
+title: Photos of London — June 2015
6
+url: /photos/2015-06-London/
7
+photos:
8
+- file: P6140016.jpg
9
+  alt: Underside of a bridge
10
+  caption: Underneath a bridge.
11
+- file: P6140071.jpg
12
+  alt: Stone lion head biting a ring.
13
+  caption: Roar.
14
+- file: P6140079.jpg
15
+  alt: Series of small anchors embedded in a wall.
16
+  caption: Navy memorial.
17
+- file: P6140109.jpg
18
+  alt: Tower Bridge lit up at dusk.
19
+  caption: Obligatory Tower Bridge shot.
20
+---

photos/2015-08-Maui/index.html → site/content/photos/2015-08-Maui.md View File

@@ -1,9 +1,13 @@
1 1
 ---
2
-layout: photos
3 2
 album_title: Maui, Hawaii, USA
4 3
 album_date: August and September 2015
5
-title: Photos of Maui, Hawaii — August 2015 · Chameth.com
4
+date: 2015-08-01
5
+title: Photos of Maui, Hawaii — August 2015
6
+url: /photos/2015-08-Maui/
6 7
 photos:
8
+- file: G0122882.jpg
9
+  alt: Turtle in a blue ocean, with a person swimming in the background
10
+  caption: That's me. The turtle was a lot more graceful in the water.
7 11
 - file: IMG_20150731_071026.jpg
8 12
   alt: View of a beach, blue ocean, and line of hotels on the shore
9 13
   caption: View out to the beach.
@@ -19,9 +23,6 @@ photos:
19 23
 - file: P7310236.jpg
20 24
   alt: Water flowing over rocks, long exposure
21 25
   caption: A teeny-tiny waterfall. A lot easier to get a picture of than the bigger ones.
22
-- file: G0122882.jpg
23
-  alt: Turtle in a blue ocean, with a person swimming in the background
24
-  caption: That's me. The turtle was a lot more graceful in the water.
25 26
 - file: P7300176.jpg
26 27
   alt: Sunrise over some clouds
27 28
   caption: Watching sunrise from above the clouds was worth getting up at 2AM for.

_posts/2016-04-10-sense-api.md → site/content/post/2016-04-10-sense-api.md View File

@@ -1,8 +1,9 @@
1 1
 ---
2
-layout: post
3
-title: Reverse engineering the Sense API
2
+date: 2016-04-10
4 3
 strapline: Who needs API docs when you can do a MITM attack?
5 4
 thumbnail: /res/images/sense/sense.thumb.jpg
5
+title: Reverse engineering the Sense API
6
+url: /2016/04/10/sense-api/
6 7
 ---
7 8
 
8 9
 <div class="image right">
@@ -70,7 +71,7 @@ Logging in to the Android app and navigating through the various screens shows t
70 71
 actually pretty nice. It's RESTful, and uses an OAuth bearer token for authorisation, as you can
71 72
 see in the `mitmproxy` output of the authentication and first few requests:
72 73
 
73
-{% highlight text %}
74
+{{< highlight text >}}
74 75
 POST https://api.hello.is/v1/oauth2/token
75 76
     ← 200 application/json 151B 1.17s
76 77
 GET https://api.hello.is/v2/account/preferences
@@ -93,7 +94,7 @@ PATCH https://api.hello.is/v1/app/stats
93 94
     ← 202 [no content] 126ms
94 95
 GET https://api.hello.is/v1/app/stats/unread
95 96
     ← 200 application/json 71B 171ms
96
-{% endhighlight %}
97
+{{< / highlight >}}
97 98
 
98 99
 #### Authorisation
99 100
 
@@ -102,7 +103,7 @@ password, and a client ID and secret. Presumably if the API is ever opened up yo
102 103
 register clients and get your own ID and secret, but for now reusing the ones from the Android
103 104
 app works fine. [I've prettified and linewrapped the content to make it a bit easier to read.]
104 105
 
105
-{% highlight http %}
106
+{{< highlight http >}}
106 107
 POST /v1/oauth2/token HTTP/1.1
107 108
 Host: api.hello.is
108 109
 Accept: */*
@@ -114,8 +115,8 @@ grant_type=password
114 115
  &client_secret=4f771f6f-5c10-4104-bbc6-3333f5b11bf9
115 116
  &username=USERNAME
116 117
  &password=PASSWORD
117
-{% endhighlight %}
118
-{% highlight http %}
118
+{{< / highlight >}}
119
+{{< highlight http >}}
119 120
 HTTP/1.1 200 OK
120 121
 Cache-Control: no-cache
121 122
 Content-Type: application/json
@@ -131,7 +132,7 @@ Connection: keep-alive
131 132
   "refresh_token":"2.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
132 133
 }
133 134
 
134
-{% endhighlight %}
135
+{{< / highlight >}}
135 136
 
136 137
 #### Sleep timeline
137 138
 
@@ -139,13 +140,13 @@ Getting the timeline for one night is just a straight up GET request. It gives a
139 140
 events, including different 'depths' of sleep (I've cut out a whole bunch here for simplicity).
140 141
 It also shows metrics relating to the entire night, and their condition ('warning' or 'ideal').
141 142
 
142
-{% highlight http %}
143
+{{< highlight http >}}
143 144
 GET /v2/timeline/2016-04-08 HTTP/1.1
144 145
 Host: api.hello.is
145 146
 Accept: */*
146 147
 Authorization: Bearer 2.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
147
-{% endhighlight %}
148
-{% highlight http %}
148
+{{< / highlight >}}
149
+{{< highlight http >}}
149 150
 HTTP/1.1 200 OK
150 151
 Cache-Control: no-cache
151 152
 Content-Type: application/json
@@ -211,7 +212,7 @@ Connection: keep-alive
211 212
     { "name":"sound", "value":null, "unit":"CONDITION", "condition":"IDEAL"}
212 213
   ]
213 214
 }
214
-{% endhighlight %}
215
+{{< / highlight >}}
215 216
 
216 217
 #### Other interesting resources
217 218
 

_posts/2016-05-02-monitoring-power-with-wemo.md → site/content/post/2016-05-02-monitoring-power-with-wemo.md View File

@@ -1,8 +1,9 @@
1 1
 ---
2
-layout: post
3
-title: Monitoring power draw with WeMo Insight Switches
2
+date: 2016-05-02
4 3
 strapline: Fun with SOAP and rrdtool
5 4
 thumbnail: /res/images/wemo/switch.thumb.jpg
5
+title: Monitoring power draw with WeMo Insight Switches
6
+url: /2016/05/02/monitoring-power-with-wemo/
6 7
 ---
7 8
 
8 9
 <div class="image right">
@@ -40,7 +41,7 @@ actions including `GetPower` and `GetTodayKWH`. Sending a SOAP request isn't too
40 41
 (albeit nowhere near as nice as a REST JSON API) &mdash; here's a sample request I made using
41 42
 the <a href="https://chrome.google.com/webstore/detail/dhc-rest-client/aejoelaoggembcahagimdiliamlcdmfm/">DHC chrome extension</a>:
42 43
 
43
-{% highlight http %}
44
+{{< highlight http >}}
44 45
 POST /upnp/control/insight1 HTTP/1.1
45 46
 Accept: */*
46 47
 Accept-Encoding: gzip, deflate
@@ -55,12 +56,12 @@ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
55 56
         <u:GetPower xmlns:u="urn:Belkin:service:insight:1"/>
56 57
     </s:Body>
57 58
 </s:Envelope>
58
-{% endhighlight %}
59
+{{< / highlight >}}
59 60
 
60 61
 The name of the action (in the SOAPACTION header) and the XML namespace in the body are both
61 62
 constructed from information in the service definition. The result that comes back is:
62 63
 
63
-{% highlight xml %}
64
+{{< highlight xml >}}
64 65
 <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
65 66
     <s:Body>
66 67
         <u:GetPowerResponse xmlns:u="urn:Belkin:service:insight:1">
@@ -68,7 +69,7 @@ constructed from information in the service definition. The result that comes ba
68 69
         </u:GetPowerResponse>
69 70
     </s:Body>
70 71
 </s:Envelope>
71
-{% endhighlight %}
72
+{{< / highlight >}}
72 73
 
73 74
 The current power draw in milliwatts is returned in the `<InstantPower>` argument.
74 75
 
@@ -80,7 +81,7 @@ app, but it's sadly missing. After a bit of research I settled on the tried and
80 81
 <a href="http://oss.oetiker.ch/rrdtool/">rrdtool</a> to store data and generate graphs. I created a
81 82
 new database to store the values from the two switches:
82 83
 
83
-{% highlight bash %}
84
+{{< highlight bash >}}
84 85
 rrdtool create power.rrd \
85 86
     --start now \
86 87
     --step 60 \
@@ -92,7 +93,7 @@ rrdtool create power.rrd \
92 93
     RRA:AVERAGE:0.5:120:1488 \
93 94
     RRA:AVERAGE:0.5:360:1488 \
94 95
     RRA:AVERAGE:0.5:1440:36500
95
-{% endhighlight %}
96
+{{< / highlight >}}
96 97
 
97 98
 This creates a database file which expects values to be given every 60 seconds for two data series:
98 99
 'wemoComputer' and 'wemoNetworking'. These are gauge types (i.e., a value we read off a gauge,
@@ -109,7 +110,7 @@ resolution.
109 110
 
110 111
 Next, I created a small python script to retrieve the power using SOAP:
111 112
 
112
-{% highlight python %}
113
+{{< highlight python >}}
113 114
 #!/usr/bin/python3
114 115
 
115 116
 import requests
@@ -126,7 +127,7 @@ def get_power(ip_and_port):
126 127
     r = requests.post("http://%s/upnp/control/insight1" % ip_and_port, headers=headers, data=payload)
127 128
     et = ElementTree.fromstring(r.text)
128 129
     return et.find('.//InstantPower').text
129
-{% endhighlight %}
130
+{{< / highlight >}}
130 131
 
131 132
 I then have a dictionary of IP addresses to data series names, and the script polls each one in
132 133
 turn and then executes an `rrdtool update` query to add the items to the database. I have this
@@ -140,7 +141,7 @@ and get the correct address from the switches' response.</ins>
140 141
 After leaving the script to run for a bit and gather data, it's time to make some graphs. I use
141 142
 the following to create a graph with a background gradient:
142 143
 
143
-{% highlight bash %}
144
+{{< highlight bash >}}
144 145
 rrdtool graph desk-1d.png
145 146
         -o -X0 -w800 -h500 \
146 147
         -u 2000 -l 20 -r \
@@ -170,7 +171,7 @@ rrdtool graph desk-1d.png
170 171
         CDEF:powere=power,20,LT,power,20,IF CDEF:powereNoUnk=power,UN,0,powere,IF AREA:powereNoUnk#00ffa8 \
171 172
         CDEF:powerd=power,0,LT,power,0,IF CDEF:powerdNoUnk=power,UN,0,powerd,IF AREA:powerdNoUnk#00ffd0 \
172 173
         LINE:power#080
173
-{% endhighlight %}
174
+{{< / highlight >}}
174 175
 
175 176
 This seems a bit unweildy, but it's fairly straight forward. The options tell rrdtool to create
176 177
 a graph with a canvas size of 800x500 pixels, a lower limit of 20W, upper limit of 2kW, and a

_posts/2016-05-21-docker-automatic-nginx-proxy.md → site/content/post/2016-05-21-docker-automatic-nginx-proxy.md View File

@@ -1,8 +1,9 @@
1 1
 ---
2
-layout: post
3
-title: Automatic reverse proxying with Docker and nginx
2
+date: 2016-05-21
4 3
 strapline: It's containers all the way down...
5 4
 thumbnail: /res/images/docker/logo.thumb.png
5
+title: Automatic reverse proxying with Docker and nginx
6
+url: /2016/05/21/docker-automatic-nginx-proxy/
6 7
 ---
7 8
 
8 9
 <div class="image left">

+ 3
- 0
site/layouts/_default/single.html View File

@@ -0,0 +1,3 @@
1
+{{ partial "head.html" . }}
2
+{{ partial "article.html" . }}
3
+{{ partial "foot.html" . }}

+ 3
- 0
site/layouts/index.html View File

@@ -0,0 +1,3 @@
1
+{{ partial "head.html" . }}
2
+{{ partial "list.html" . }}
3
+{{ partial "foot.html" . }}

+ 33
- 0
site/layouts/partials/album.html View File

@@ -0,0 +1,33 @@
1
+<article class="post">
2
+  <header>
3
+    <div class="title">
4
+      <h2>{{ .Title }}</h2>
5
+      <p>{{ .Params.strapline }}</p>
6
+    </div>
7
+  </header>
8
+
9
+  {{ range $photo := .Params.photos }}
10
+    <a href="{{ replace $.URL "/photos/" "https://photos.chameth.com/" }}{{ $photo.file }}"
11
+       class="image gallery"
12
+       data-lightbox="gallery"
13
+       data-title="{{ $photo.caption }}">
14
+      <img src="{{ $photo.file }}" alt="{{ $photo.alt }}">
15
+    </a>
16
+  {{ end }}
17
+
18
+
19
+</article>
20
+
21
+<div id="disqus_thread"></div>
22
+<script>
23
+var disqus_config = function () {
24
+this.page.url = "{{ .Permalink }}";
25
+};
26
+(function() {
27
+var d = document, s = d.createElement('script');
28
+s.src = '//chameth.disqus.com/embed.js';
29
+s.setAttribute('data-timestamp', +new Date());
30
+(d.head || d.body).appendChild(s);
31
+})();
32
+</script>
33
+<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>

_layouts/post.html → site/layouts/partials/article.html View File

@@ -1,22 +1,18 @@
1
----
2
-layout: default
3
----
4 1
 <article class="post">
5 2
   <header>
6 3
     <div class="title">
7
-      <h2>{{ page.title }}</h2>
8
-      <p>{{ page.strapline }}</p>
9
-      <p>{{ page.date | date: '%B %d, %Y' }}</p>
4
+      <h2>{{ .Title }}</h2>
5
+      <p>{{ .Params.strapline }}</p>
6
+      <p>{{ .Date.Format "Jan 2, 2006" }}</p>
10 7
     </div>
11 8
   </header>
12
-  {{ content }}
9
+  {{ .Content }}
13 10
 </article>
14 11
 
15 12
 <div id="disqus_thread"></div>
16 13
 <script>
17 14
 var disqus_config = function () {
18
-this.page.url = "https://www.chameth.com{{ page.url }}";
19
-this.page.identifier = "{{ page.url }}";
15
+this.page.url = "https://www.chameth.com{{ .Permalink }}";
20 16
 };
21 17
 (function() {
22 18
 var d = document, s = d.createElement('script');

+ 39
- 0
site/layouts/partials/foot.html View File

@@ -0,0 +1,39 @@
1
+</div>
2
+
3
+<section id="sidebar">
4
+  <header>
5
+    <h1><a href="/">Chameth.com</a></h1>
6
+    <p>Personal website of Chris Smith</p>
7
+  </header>
8
+
9
+  <section id="posts">
10
+    <h2>Latest posts</h2>
11
+    {{ range first 3 (where .Site.Pages "Type" "post") }}
12
+      <article class="mini-post">
13
+        <header>
14
+          <h3><a href="{{ .Permalink }}">{{ .Title }}</a></h3>
15
+        </header>
16
+        <a href="{{ .Permalink }}" class="image"><img src="{{ .Params.thumbnail }}" alt="{{ .Title }}"></a>
17
+      </article>
18
+    {{ end }}
19
+  </section>
20
+
21
+  <section id="photos">
22
+    <h2>Recent albums</h2>
23
+
24
+    {{ range first 3 (where .Site.Pages "Type" "photos") }}
25
+      <article class="mini-post">
26
+        <header>
27
+          <h3><a href="{{ .Permalink }}">{{ .Params.album_title }}</a></h3>
28
+          <time class="published" datetime="{{ .Date }}">{{ .Params.album_date }}</time>
29
+        </header>
30
+        <a href="{{ .Permalink }}" class="image"><img src="{{ .URL }}{{ (index .Params.photos 0).file }}" alt="{{ (index .Params.photos 0).alt }}"></a>
31
+      </article>
32
+    {{ end }}
33
+
34
+  </section>
35
+</section>
36
+</div>
37
+<script src="/res/js/lightbox-plus-jquery.min.js"></script>
38
+</body>
39
+</html>

+ 27
- 0
site/layouts/partials/head.html View File

@@ -0,0 +1,27 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <title>
5
+      {{ if $.IsPage }}
6
+        {{ .Title }}
7
+        &middot;
8
+        {{ .Site.Title }}
9
+      {{ else }}
10
+        {{ .Title }}
11
+        {{ if not $.IsHome }}
12
+          &middot;
13
+          {{ .Site.Title }}
14
+        {{ end }}
15
+      {{ end }}
16
+    </title>
17
+    <meta charset="utf-8">
18
+    <link rel="stylesheet" href="/res/css/style.css">
19
+    <link rel="stylesheet" href="/res/css/monokai.css">
20
+    <link rel="stylesheet" href="/res/css/lightbox.min.css">
21
+    {{ if .RSSlink }}
22
+      <link href="{{ .RSSlink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" />
23
+    {{ end }}
24
+  </head>
25
+  <body>
26
+    <div id="wrapper">
27
+      <div id="main">

+ 22
- 0
site/layouts/partials/list.html View File

@@ -0,0 +1,22 @@
1
+{{ $paginator := .Paginate (where .Site.Pages "Type" "post") }}
2
+{{ range $paginator.Pages }}
3
+<article class="post">
4
+  <header>
5
+    <div class="title">
6
+      <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
7
+      <p>{{ .Params.strapline }}</p>
8
+    </div>
9
+  </header>
10
+  {{ .Summary }}
11
+  <footer>
12
+    <ul>
13
+      <li><a href="{{ .Permalink }}">Read more</a></li>
14
+      <li><a href="{{ .Permalink }}#disqus_thread" class="comments"></a></li>
15
+    </ul>
16
+  </footer>
17
+</article>
18
+
19
+{{ end }}
20
+{{ partial "pagination" . }}
21
+
22
+<script id="dsq-count-scr" src="//chameth.disqus.com/count.js" async></script>

+ 14
- 0
site/layouts/partials/pagination.html View File

@@ -0,0 +1,14 @@
1
+<nav id="page-nav">
2
+{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
3
+    {{ if .Paginator.HasPrev }}
4
+        <a class="extend prev" rel="prev" href="{{.Paginator.Prev.URL}}">
5
+            « Previous
6
+        </a>
7
+    {{ end }}
8
+    {{ if .Paginator.HasNext }}
9
+        <a class="extend next" rel="next" href="{{.Paginator.Next.URL}}">
10
+            Next »
11
+        </a>
12
+    {{ end }}
13
+{{ end }}
14
+</nav>

+ 3
- 0
site/layouts/photos/single.html View File

@@ -0,0 +1,3 @@
1
+{{ partial "head.html" . }}
2
+{{ partial "album.html" . }}
3
+{{ partial "foot.html" . }}

.well-known/keybase.txt → site/static/.well-known/keybase.txt View File


photos/2013-02-SanFrancisco/2013-01-26 10.14.05.JPG → site/static/photos/2013-02-SanFrancisco/2013-01-26 10.14.05.JPG View File


photos/2013-02-SanFrancisco/2013-01-27 07.41.59.JPG → site/static/photos/2013-02-SanFrancisco/2013-01-27 07.41.59.JPG View File


photos/2013-02-SanFrancisco/2013-01-27 07.46.51.JPG → site/static/photos/2013-02-SanFrancisco/2013-01-27 07.46.51.JPG View File


photos/2013-02-SanFrancisco/2013-01-27 08.41.22.JPG → site/static/photos/2013-02-SanFrancisco/2013-01-27 08.41.22.JPG View File


photos/2013-02-SanFrancisco/2013-01-27 10.04.37.JPG → site/static/photos/2013-02-SanFrancisco/2013-01-27 10.04.37.JPG View File


photos/2013-02-SanFrancisco/2013-01-30 20.24.19.JPG → site/static/photos/2013-02-SanFrancisco/2013-01-30 20.24.19.JPG View File


photos/2013-02-SanFrancisco/2013-01-30 20.37.13.JPG → site/static/photos/2013-02-SanFrancisco/2013-01-30 20.37.13.JPG View File


photos/2013-02-SanFrancisco/2013-02-01 09.23.46.JPG → site/static/photos/2013-02-SanFrancisco/2013-02-01 09.23.46.JPG View File


photos/2013-02-SanFrancisco/2013-02-02 10.15.13.JPG → site/static/photos/2013-02-SanFrancisco/2013-02-02 10.15.13.JPG View File


photos/2013-02-SanFrancisco/2013-02-02 11.46.28.JPG → site/static/photos/2013-02-SanFrancisco/2013-02-02 11.46.28.JPG View File


photos/2013-02-SanFrancisco/2013-02-02 12.17.03.JPG → site/static/photos/2013-02-SanFrancisco/2013-02-02 12.17.03.JPG View File


photos/2013-02-SanFrancisco/2013-02-02 12.31.57.JPG → site/static/photos/2013-02-SanFrancisco/2013-02-02 12.31.57.JPG View File


photos/2013-02-SanFrancisco/2013-02-02 12.46.49.JPG → site/static/photos/2013-02-SanFrancisco/2013-02-02 12.46.49.JPG View File


photos/2013-02-SanFrancisco/2013-02-03 10.37.02.JPG → site/static/photos/2013-02-SanFrancisco/2013-02-03 10.37.02.JPG View File


photos/2013-02-SanFrancisco/2013-02-03 11.03.55.JPG → site/static/photos/2013-02-SanFrancisco/2013-02-03 11.03.55.JPG View File


BIN
site/static/photos/2015-06-London/P6140016.jpg View File


BIN
site/static/photos/2015-06-London/P6140071.jpg View File


BIN
site/static/photos/2015-06-London/P6140079.jpg View File


BIN
site/static/photos/2015-06-London/P6140109.jpg View File


photos/2015-08-Maui/G0122882.jpg → site/static/photos/2015-08-Maui/G0122882.jpg View File


photos/2015-08-Maui/IMG_20150730_070036.jpg → site/static/photos/2015-08-Maui/IMG_20150730_070036.jpg View File


photos/2015-08-Maui/IMG_20150731_071026.jpg → site/static/photos/2015-08-Maui/IMG_20150731_071026.jpg View File


photos/2015-08-Maui/P7300158.jpg → site/static/photos/2015-08-Maui/P7300158.jpg View File


photos/2015-08-Maui/P7300176.jpg → site/static/photos/2015-08-Maui/P7300176.jpg View File


photos/2015-08-Maui/P7310186.jpg → site/static/photos/2015-08-Maui/P7310186.jpg View File


photos/2015-08-Maui/P7310206.jpg → site/static/photos/2015-08-Maui/P7310206.jpg View File


photos/2015-08-Maui/P7310207.jpg → site/static/photos/2015-08-Maui/P7310207.jpg View File


photos/2015-08-Maui/P7310220.jpg → site/static/photos/2015-08-Maui/P7310220.jpg View File


photos/2015-08-Maui/P7310236.jpg → site/static/photos/2015-08-Maui/P7310236.jpg View File


photos/2015-08-Maui/P7310285.jpg → site/static/photos/2015-08-Maui/P7310285.jpg View File


photos/2015-08-Maui/PANO_20150729_073240.jpg → site/static/photos/2015-08-Maui/PANO_20150729_073240.jpg View File


photos/2015-08-Maui/PANO_20150731_100829.jpg → site/static/photos/2015-08-Maui/PANO_20150731_100829.jpg View File


res/css/lightbox.min.css → site/static/res/css/lightbox.min.css View File


res/css/monokai.css → site/static/res/css/monokai.css View File


res/css/style.css → site/static/res/css/style.css View File


res/images/background.jpg → site/static/res/images/background.jpg View File


res/images/close.png → site/static/res/images/close.png View File


res/images/docker/logo.png → site/static/res/images/docker/logo.png View File


res/images/docker/logo.thumb.png → site/static/res/images/docker/logo.thumb.png View File


res/images/docker/reverse-proxy.png → site/static/res/images/docker/reverse-proxy.png View File


res/images/loading.gif → site/static/res/images/loading.gif View File


res/images/next.png → site/static/res/images/next.png View File


res/images/prev.png → site/static/res/images/prev.png View File


res/images/sense/sense.jpg → site/static/res/images/sense/sense.jpg View File


res/images/sense/sense.thumb.jpg → site/static/res/images/sense/sense.thumb.jpg View File


res/images/wemo/desk-1d.png → site/static/res/images/wemo/desk-1d.png View File


res/images/wemo/desk-1w.png → site/static/res/images/wemo/desk-1w.png View File


res/images/wemo/switch.jpg → site/static/res/images/wemo/switch.jpg View File


res/images/wemo/switch.thumb.jpg → site/static/res/images/wemo/switch.thumb.jpg View File


res/js/lightbox-plus-jquery.min.js → site/static/res/js/lightbox-plus-jquery.min.js View File


res/js/lightbox.min.js → site/static/res/js/lightbox.min.js View File


Loading…
Cancel
Save