-
Notifications
You must be signed in to change notification settings - Fork 1
/
atom.xml
633 lines (471 loc) · 34.7 KB
/
atom.xml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[hoc est repo meum.]]></title>
<link href="http://schuyler.github.com/atom.xml" rel="self"/>
<link href="http://schuyler.github.com/"/>
<updated>2012-09-16T09:55:38-10:00</updated>
<id>http://schuyler.github.com/</id>
<author>
<name><![CDATA[Schuyler Erle]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[How to make an AMI from a running Ubuntu EC2 instance.]]></title>
<link href="http://schuyler.github.com/blog/how-to-make-an-ami-from-a-running-ec2-instance.html"/>
<updated>2012-09-16T09:34:00-10:00</updated>
<id>http://schuyler.github.com/blog/how-to-make-an-ami-from-a-running-ec2-instance</id>
<content type="html"><![CDATA[<p>First, you’ll need the <code>ec2-ami-tools</code> package. Assuming you’re running Ubuntu
12.04, go into <code>/etc/apt/sources.list</code> and uncomment the <code>multiverse</code> lines.
Then run:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>apt-get update
</span><span class='line'>apt-get install -y ec2-ami-tools
</span></code></pre></td></tr></table></div></figure>
<p>Next, upload your <code>pk-*.pem</code> and <code>cert-*.pem</code> files to <code>/mnt</code> on the
running instance. Don’t worry, <code>ec2-bundle-vol</code> ignores <code>*.pem</code> and the
entirety of <code>/mnt</code> by default, so your credentials won’t get built into
the image.</p>
<p>Now, as root, create a place to put the image bundle and then build it.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>mkdir /mnt/bundle
</span><span class='line'>ec2-bundle-vol -d /mnt/bundle -k pk-*.pem -c cert-*.pem <span class="se">\</span>
</span><span class='line'> -u YOUR_AWS_ID_WITHOUT_DASHES -r x86_64
</span></code></pre></td></tr></table></div></figure>
<p>This will bundle up a 64-bit image in <code>/mnt/ami-instance-name</code>. Change <code>x86_64</code>
to <code>i386</code> if you’re building a 32-bit image instead. The process took
about 2.5 minutes on an m2.4xlarge instance.</p>
<p>Next, upload the AMI bundle to S3. The <code>-b</code> argument to <code>ec2-upload-bundle</code>
lets you specify which S3 bucket to upload to. If the argument includes a
slash, the part after is an optional AMI name. The name doesn’t mean anything
to Amazon, but it lets you keep multiple bundles in the same bucket.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>ec2-upload-bundle -b my-ec2-bucket/my-ami <span class="se">\</span>
</span><span class='line'> -m /mnt/bundle/image.manifest.xml
</span><span class='line'> -a YOUR_AWS_ACCESS_KEY -s YOUR_AWS_SECRET_KEY
</span></code></pre></td></tr></table></div></figure>
<p>This process also takes a couple minutes.</p>
<p>Finally, register your AMI with EC2.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>ec2-register -K pk-*.pem -C cert-*.pem my-ec2-bucket/my-ami/image.manifest.xml
</span></code></pre></td></tr></table></div></figure>
<p>EC2 should respond with something like:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>IMAGE ami-deadbeef
</span></code></pre></td></tr></table></div></figure>
<p>Voilà, you are are good to go. If you wind up doing this a lot, consider
scripting the process <a href="http://instantbadger.blogspot.com/2009/09/how-to-create-and-save-ami-image-from.html">like Alistair Davidson did</a>.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[How to fix install_name_tool errors with virtualenv on OS X.]]></title>
<link href="http://schuyler.github.com/blog/how-to-fix-install-name-tool-errors-with-virtualenv-on-os-x.html"/>
<updated>2012-09-07T17:10:00-10:00</updated>
<id>http://schuyler.github.com/blog/how-to-fix-install-name-tool-errors-with-virtualenv-on-os-x</id>
<content type="html"><![CDATA[<p><a href="https://github.com/pypa/virtualenv/issues/7#issuecomment-3354141">This Github ticket comment</a>
solved an issue I was having on OS X 10.6, where running <code>virtualenv .</code> locally
failed with this error:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>install_name_tool: for architecture cputype (16777223) cpusubtype (-2147483645)
</span><span class='line'>Could not call install_name_tool -- you must have Apple's development tools installed</span></code></pre></td></tr></table></div></figure>
<p>The fix was installing the <code>feature/install_name_tool</code> branch of Gregg Lind’s
virtualenv fork.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git clone https://github.com/gregglind/virtualenv.git
</span><span class='line'>cd virtualenv
</span><span class='line'>git checkout feature/install_name_tool
</span><span class='line'>sudo python setup.py install</span></code></pre></td></tr></table></div></figure>
<p>Thank goodness (and Gregg) I don’t have to download and reinstall XCode.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[How to permanently remove files from a Git repository.]]></title>
<link href="http://schuyler.github.com/blog/how-to-permanently-remove-files-from-a-git-repo.html"/>
<updated>2012-09-06T10:22:00-10:00</updated>
<id>http://schuyler.github.com/blog/how-to-permanently-remove-files-from-a-git-repo</id>
<content type="html"><![CDATA[<p>Oops. I did a <code>git commit .</code> and then the subsequent <code>git push</code> took
suspiciously long. Yep, that’s right, I’ve pushed a gigantic binary up to my
remote Git repo by accident. How do I remove the file from the repository
permanently?</p>
<!-- more -->
<p>I found a
<a href="http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/">basic solution</a>
given as a shell script, which I just decided to run manually on my local repo.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span>git filter-branch -f --index-filter <span class="s2">"git rm -rf --cached --ignore-unmatch full/path/to/the/offending.file"</span> HEAD
</span><span class='line'>Rewrite 118bbd4b7b02f01cc221c11aec2705cbxxxxxxxx <span class="o">(</span>59/59<span class="o">)</span>
</span><span class='line'>Ref <span class="s1">'refs/heads/master'</span> was rewritten
</span><span class='line'><span class="nv">$ </span>rm -rf .git/refs/original/ <span class="o">&&</span> git reflog expire --all <span class="o">&&</span> git gc --aggressive --prune
</span></code></pre></td></tr></table></div></figure>
<p>You can
<a href="http://dalibornasevic.com/posts/2-permanently-remove-files-and-folders-from-a-git-repository">read a little more</a>
about how this works, if you like.</p>
<p>This approach worked fine locally, but doing a forced push with <code>git push -f</code>
gave me a <code>[remote rejected]</code> error, apparently because, as described
in <a href="http://stackoverflow.com/questions/1270514/undoing-a-git-push">this StackOverflow post</a>,
I have the remote repo configured with <code>receive.denyNonFastForwards</code>.</p>
<p>Fortunately, this clusterfuck was on a private repository on my own server, so
I could log in and repair the damage manually. If the repo was on Github, I’d have
been <a href="https://help.github.com/articles/remove-sensitive-data">basically out of luck</a>.</p>
<p>So I logged in and ran <code>su</code> in order to run commands as the <code>git</code> user on my
system (which owns the remote repos).</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span>sudo su - git
</span><span class='line'><span class="nv">$ </span><span class="nb">cd</span> /path/to/my/repo
</span></code></pre></td></tr></table></div></figure>
<p>Then I ran the <code>git filter-branch</code> command above on the remote repo, which succeeded,
and then running <code>git pull</code> locally also succeeded:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'> + 119bbd4...eeaxxxxx master -> origin/master <span class="o">(</span>forced update<span class="o">)</span>
</span><span class='line'>Merge made by recursive.
</span></code></pre></td></tr></table></div></figure>
<p>The lesson? Always run <code>git status</code> before running <code>git commit .</code> or <code>git
commit -a</code> – and use <code>git commit --amend</code> judiciously <em>before</em> <code>git push</code> if
you screw up! Screwups in the local repo are easier to fix before they get
pushed.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[How to install Ubuntu packages non-interactively.]]></title>
<link href="http://schuyler.github.com/blog/how-to-install-ubuntu-packages-non-interactively.html"/>
<updated>2012-08-30T18:26:00-10:00</updated>
<id>http://schuyler.github.com/blog/how-to-install-ubuntu-packages-non-interactively</id>
<content type="html"><![CDATA[<p>God bless the German OpenStreetMap developers, because enough of them like
either Debian or Ubuntu that they ship their source code with Debian packaging.
Building <a href="http://wiki.openstreetmap.org/wiki/Osm2pgsql">osm2pgsql</a> becomes a
simple matter of doing this:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span>svn co http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/
</span><span class='line'><span class="nv">$ </span><span class="nb">cd </span>osm2pgsql
</span><span class='line'><span class="nv">$ </span>debuild
</span></code></pre></td></tr></table></div></figure>
<p>If you do this, you wind up with two Debian packages:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span>ls ../*.deb
</span><span class='line'>../openstreetmap-postgis-db-setup_0.80.0-13~precise1_all.deb
</span><span class='line'>../osm2pgsql_0.80.0-13~precise1_amd64.deb
</span></code></pre></td></tr></table></div></figure>
<p>Which is great, because then you can install
<code>openstreetmap-postgis-db-setup</code> using, say, <code>dpkg -i</code>, and it’ll
automatically create a <code>gis</code> user and a <code>gis</code> database with PostGIS
extensions for use with <code>osm2pgsql</code>. The not-so-great part is that the
package install asks you a bunch of questions about what you want to call
the database and the PostgreSQL user, which is fine, until you’re trying to
automate the process of building a Planet.osm database on EC2, and then it
means your script will hang on a silly curses prompt.</p>
<!-- more -->
<p>The solution I found by searching the Internet is to <a href="http://serverfault.com/questions/197495/ubuntu-dpkg-non-interactive-installation">use the
DEBIAN_FRONTEND environment variable</a>:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ DEBIAN_FRONTEND</span><span class="o">=</span>noninteractive dpkg --install ../openstreetmap-postgis-db-setup_0.80.0-13~precise1_all.deb
</span></code></pre></td></tr></table></div></figure>
<p>Which is great if you’re root. But try to do it with <code>sudo</code> and you’re
boned, because <code>sudo</code> clears the environment as a security measure. Here’s
the fix for that:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span>sudo su -c <span class="s1">'DEBIAN_FRONTEND=noninteractive dpkg --install ../*.deb'</span>
</span></code></pre></td></tr></table></div></figure>
<p>This uses <code>sudo</code> to start a root shell via <code>su</code> and then executes <code>dpkg</code>
with the right environment variable from there. Unwieldy, but it works.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Why --hstore-column doesn't work in osm2pgsql.]]></title>
<link href="http://schuyler.github.com/blog/why-hstore-column-doesnt-work-in-osm2pgsql.html"/>
<updated>2012-08-30T18:00:00-10:00</updated>
<id>http://schuyler.github.com/blog/why-hstore-column-doesnt-work-in-osm2pgsql</id>
<content type="html"><![CDATA[<p>Today I tried using the <code>--hstore-column</code> option in
<a href="http://wiki.openstreetmap.org/wiki/Osm2pgsql">osm2pgsql</a> to import all the
<code>name:*</code> tags, because I’m building a gazetteer and I want all of the
various localized names of all the places in OpenStreetMap. The option is
supposed to create an <code>hstore</code> column called <code>name:</code> in the <code>planet_osm_*</code>
tables, with key-value pairs where the key is whatever comes after that, which
is usually the ISO code for the language of the name.</p>
<p>However, when I ran <code>osm2pgsql</code> with <code>--hstore-column "name:*"</code>, the column
was created but never populated. What the hell?</p>
<!-- more -->
<p>I guess <code>--hstore-column</code> isn’t widely used, because some adventurous soul
added some code in <code>output-pgsql.c</code> which very helpfully strips out tags
from OSM objects that aren’t listed in the <code>.style</code> file. The giveaway was
this bit of commentary in <code>pgsql_filter_tags()</code>:</p>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="cm">/* We used to only go far enough to determine if it's a polygon or not,</span>
</span><span class='line'><span class="cm">but now we go through and filter stuff we don't need */</span>
</span></code></pre></td></tr></table></div></figure>
<p>I guess whoever made the change accidentally forgot to check
<code>Options->hstore_columns</code>. Understandable. Osm2pgsql’s hstore support is
kind of an outlier of a feature. Well, not to worry. I
<a href="https://github.com/schuyler/osm2pgsql/commit/c19b6bb52338cddd9dcb9c8d0ecfda85be2b8eda">fixed it</a>
in my Github mirror, and
<a href="https://trac.openstreetmap.org/ticket/4547">filed a bug</a> with a patch in OSM’s
Trac. As a bonus, <code>--hstore-column</code> once again respects <code>--hstore-match-only</code>.</p>
<p>Apparently, I have an OSM SVN account, but it’s been so long since I
committed anything that I forget my password, so now I’m waiting for an
admin to reset it. Otherwise, I’d commit the patch myself. Oops!</p>
<p><strong>UPDATE</strong> (2012-09-02): TomH was kind enough to reset my password, so
I <a href="https://trac.openstreetmap.org/changeset/28671/applications/utils/export/osm2pgsql">committed my patch</a> but apmon discovered that a logic bug
caused segfaults when no <code>--hstore-column</code> flag was set, so he
<a href="https://trac.openstreetmap.org/changeset/28683/applications/utils/export/osm2pgsql">fixed that</a>. Both changes are now in <a href="https://trac.openstreetmap.org/browser/applications/utils/export/osm2pgsql">Subversion</a> and in
<a href="http://github.com/schuyler/osm2pgsql">my github repo</a>.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[How to setup a new Octopress blog on Github Pages.]]></title>
<link href="http://schuyler.github.com/blog/how-to-setup-a-new-octopress-blog-on-github-pages.html"/>
<updated>2012-08-29T18:10:00-10:00</updated>
<id>http://schuyler.github.com/blog/how-to-setup-a-new-octopress-blog-on-github-pages</id>
<content type="html"><![CDATA[<p>The yak shaving started when I wanted a new blog that was easy to update, easy
to maintain, didn’t depend on anything fancy, wasn’t my personal blog (still
running on blosxom), and wasn’t WordPress. Enter <a href="http://octopress.org/">Octopress</a>,
whose virtues I will let speak for themselves.</p>
<p>Here is a rapid-fire Octopress Github OS X tutorial on how to get Octopress
publishing to Github Pages from OS X. I refer you to the
<a href="http://octopress.org/docs/">Octopress documentation</a>
for actual detailed instructions.</p>
<!-- more -->
<h3>Octopress wants Ruby 1.9.3 and OS X comes with 1.8.7.</h3>
<p>Solution: <a href="http://octopress.org/docs/setup/rvm/">Something called RVM</a>. Ruby
Version Manager? Who cares.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ curl -L https://get.rvm.io | bash -s stable --ruby</span></code></pre></td></tr></table></div></figure>
<p>This installs a bunch of crap (i.e. Ruby 1.9) to <code>~/.rvm/</code> in your home
directory but whatever. It also has the somewhat unsavory side effect of adding
this to your <code>.bashrc</code>:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting</span></code></pre></td></tr></table></div></figure>
<p>Hey! Thanks for letting me know, jerk. Well, source your <code>.bashrc</code> to get the
new version of Ruby and move on.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ source ~/.bashrc</span></code></pre></td></tr></table></div></figure>
<h3>Get Octopress and its dependencies.</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ git clone git://github.com/imathis/octopress.git my_new_blogue
</span><span class='line'>$ cd my_new_blogue
</span><span class='line'>$ bundle install</span></code></pre></td></tr></table></div></figure>
<p>This creates the local repo that will contain your new static weblog
by <a href="http://octopress.org/docs/setup/">cloning imathis’s Octopress source tree</a> into <code>my_new_blogue/</code>,
and then chdirs into it and installs its delightful Ruby prerequisites. Into <code>~/.rvm</code> again. I
think.</p>
<h3>Copy the classic Octopress theme.</h3>
<p>From inside <code>my_new_blogue/</code> (or whatever you called it):</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ rake install</span></code></pre></td></tr></table></div></figure>
<p>You want a different theme? Figure it out yourself, kid. Look in
the <code>.themes/</code> directory.</p>
<h3>Fix some bugs in Octopress manually.</h3>
<p>Hopefully, you are reading this far enough in the future that these
workarounds are no longer necessary. However, if not, then you
will want to
<a href="http://schuyler.github.com/blog/how-to-cherry-pick-a-git-commit-from-another-repo.html">fix the busted Github plugin</a> and
you probably will want to <a href="https://github.com/imathis/octopress/issues/417">fix list indentation</a>. I hope that
imathis gets around to fixing this stuff in HEAD. Moving along…</p>
<h3>Setup to deploy to username.github.com</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ rake setup_github_pages</span></code></pre></td></tr></table></div></figure>
<p>This does a bunch of stuff, which is
<a href="http://octopress.org/docs/deploying/github/">documented</a>
but the part you care about is where it asks you for
the repo URL, tell it <code>git@github.com:username/username.github.com</code> while
substituting as necessary.</p>
<h3>Configure your shiny new blog.</h3>
<p><a href="http://octopress.org/docs/configuring/">Configure the thing</a> by editing the <code>_config.yml</code>
file in the top-level directory. I only changed the following settings. You
probably want to leave everything else alone, to start.</p>
<ul>
<li><code>url</code></li>
<li><code>title</code></li>
<li><code>subtitle</code></li>
<li><code>author</code></li>
<li><code>description</code></li>
<li><code>github_user</code></li>
<li><code>twitter_user</code></li>
<li><code>googleplus_user</code></li>
<li><code>disqus_short_name</code></li>
</ul>
<p>You’ll only want to set a <code>disqus_short_name</code> if you want comments. You need to
<a href="http://disqus.com/">sign up</a> for the Disqus service, of course. I thought it
wasn’t a bad idea. Lack of comments was the main thing I came to dislike about
blosxom, pretty much.</p>
<p>Other stuff I monkeyed with but you probably shouldn’t unless you know what
you’re doing and why:</p>
<ul>
<li><code>date_format</code></li>
<li><code>permalink</code></li>
<li><code>paginate</code></li>
<li><code>excerpt_link</code></li>
<li><code>titlecase</code></li>
<li><code>github_repo_count</code></li>
<li><code>github_skip_forks</code></li>
<li><code>twitter_tweet_count</code></li>
<li><code>googleplus_hidden</code></li>
<li><code>facebook_like</code></li>
</ul>
<p>I set <code>date_format</code> to <code>"%F"</code> because this is a hacker blog and ISO 8601, so there.</p>
<p>I changed the permalink format because why <em>also</em> put the date in the URL. <em>Do
not</em> bother taking <code>/blog/</code> out of the permalink, because that part is
hardcoded into the archive URL, so <em>le sigh</em>.</p>
<p>I turned off <code>titlecase</code> because I like my titles lowercased, thank you.</p>
<p>I added my G+ ID and FB liking because I am kind of a whore that way. I turned
off Tweet count because I am not <em>that</em> much of a whore.</p>
<h3>Writing new posts.</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ rake new_post["This is the title of my new post."]</span></code></pre></td></tr></table></div></figure>
<p>Then you gotta find the filename it prints out under <code>source/_posts/</code> somewhere
and go <a href="http://octopress.org/docs/blogging/">edit that file with Markdown</a> or something.</p>
<p>Running <code>rake preview</code> and then visiting
<a href="http://localhost:4000/">http://localhost:4000/</a> is kind of nice because
then you actually can see what it’s all going to look like before you upload to
Github Pages. A+++ WOULD PREVIEW AGAIN.</p>
<h3>Publishing.</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ rake generate
</span><span class='line'>$ rake deploy</span></code></pre></td></tr></table></div></figure>
<p>Don’t ask me why these are two separate steps. Now you can go look at
http://username.github.com/ or whatever and voilà your new blogue.</p>
<p>BUT WAIT. You’re not done yet. You’ve deployed the <em>content</em> but you still have
to commit your original writings in Markdown format to Github for all
prosperity. This happens in a separate <code>source</code> branch (which if you run <code>git
branch</code> you will see is already checked out locally, thanks to <code>rake
setup_github_pages</code>).</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ git add .
</span><span class='line'>$ git commit -m "I made a post." -a
</span><span class='line'>$ git push</span></code></pre></td></tr></table></div></figure>
<p>In other words, your Markdown goes in the <code>source</code> branch and the resulting HTML
winds up in the <code>master</code> branch, which is what Github is supposed to publish
at your URL. If this doesn’t happen – and it should have already, if you did
everything in the given order – then
<a href="http://octopress.org/docs/deploying/github/">please note the following</a>:</p>
<blockquote><p>Note: With new repositories, Github sets the default branch based on the
branch you push first, and it looks there for the generated site content. If
you’re having trouble getting Github to publish your site, go to the admin
panel for your repository and make sure that the master branch is the default
branch.</p></blockquote>
<p>At any rate, Github gets to keep both branches, so that you can always
remake one from the other.</p>
<h3>FOR BONUS POINTS: Custom Domains.</h3>
<p>Set your <code>A</code> record for <code>my-blogue.com</code> to point to <code>207.97.227.245</code> (this is
an IP address for <code>pages.github.com</code>) and your <code>CNAME</code> for <code>*.my-blogue.com</code> to
point to <code>username.github.com</code>. <em>Don’t</em> set your main domain to a <code>CNAME</code>
instead of an <code>A</code> record, because don’t, that’s why.</p>
<p>Then do:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>echo 'myblogue.com' >> source/CNAME
</span><span class='line'>rake generate
</span><span class='line'>rake deploy</span></code></pre></td></tr></table></div></figure>
<p>And wait ten minutes. Seriously, that’s it. While you’re waiting, don’t forget
to:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git add source/CNAME
</span><span class='line'>git commit -m "Hooray, my very own domain"
</span><span class='line'>git push</span></code></pre></td></tr></table></div></figure>
<h3>NOW GO BLOGUE AWAY.</h3>
<p>And, for God’s <em>sake</em>, change the <code>favicon.png</code> right now.</p>
<p>Remember when I said this would be a rapid-fire tutorial? SHUT UP.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[How to cherry-pick a Git commit from another repo.]]></title>
<link href="http://schuyler.github.com/blog/how-to-cherry-pick-a-git-commit-from-another-repo.html"/>
<updated>2012-08-29T15:43:00-10:00</updated>
<id>http://schuyler.github.com/blog/how-to-cherry-pick-a-git-commit-from-another-repo</id>
<content type="html"><![CDATA[<p>So, as soon as I got this blog started, I discovered that the Github plugin on
the right side wasn’t showing any repos. Naturally, I googled for the
<a href="https://github.com/imathis/octopress/issues/636">error message</a> and found
<a href="https://github.com/imathis/octopress/issues/636#issuecomment-8113731">a reference</a> to
<a href="https://github.com/imathis/octopress/pull/732">a pull request</a> for
<a href="https://github.com/djohnsonm/octopress/commit/dd8b24f94c6cb86124d7bc3c8cf0ada6c974e214">a commit</a>
that fixed the issue. How to apply David Johnson’s fix without possibly
screwing up everything else in my local Octopress repo?</p>
<!-- more -->
<p>First, add his fork as a remote, fetch it, and make sure that the desired
commit is in there.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git remote add djohnsonm https://github.com/djohnsonm/octopress.git
</span><span class='line'>git fetch djohnsonm
</span><span class='line'>git log djohnsonm/master</span></code></pre></td></tr></table></div></figure>
<p>Sure enough, the fix is at the top.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>commit dd8b24f94c6cb86124d7bc3c8cf0ada6c974e214
</span><span class='line'>Author: David Johnson <djohnson.m@gmail.com>
</span><span class='line'>Date: Tue Aug 28 21:31:20 2012 -0500
</span><span class='line'>
</span><span class='line'>Update .themes/classic/source/javascripts/github.js
</span><span class='line'>
</span><span class='line'>Fixed the github repo url to return an valid url and not just .json.</span></code></pre></td></tr></table></div></figure>
<p>So <code>git cherry-pick</code> to the rescue. Just give it a reference to the commit
you want to cherry pick. You don’t even need to say which branch you want it
from, because Git already knows which branch contains that commit.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git cherry-pick dd8b24</span></code></pre></td></tr></table></div></figure>
<p>That’s all you have to do as far as Git is concerned.</p>
<p>In terms of fixing the issue in Octopress, note that this doesn’t actually
update <code>source/</code> – just <code>.themes/source/</code>, so copy the file manually, commit,
and push.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>cp .themes/classic/source/javascripts/github.js source/javascripts/
</span><span class='line'>git commit -m "Deploy the applied github.js fix."
</span><span class='line'>git push</span></code></pre></td></tr></table></div></figure>
<p>Then, since this is Octopress, rebuild the site and deploy.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rake generate
</span><span class='line'>rake deploy</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[How to shave a yak, part 1 of n.]]></title>
<link href="http://schuyler.github.com/blog/how-to-shave-a-yak-pt-1.html"/>
<updated>2012-08-29T12:20:00-10:00</updated>
<id>http://schuyler.github.com/blog/how-to-shave-a-yak-pt-1</id>
<content type="html"><![CDATA[<p>(… an hour and a half of setting up Octopress later …)</p>
<p>A new blog is always a hopeful endeavor, isn’t it? Shining with wide-eyed
optimism at the prospect of disciplined posting schedules and ever-mounting
readership.</p>
<p>Well. I don’t much expect anyone to find their way here except by Googling for
an error message and finding this by accident. I intend to post about the
technical problems I have on a daily basis developing and deploying software. I
just wanted a place to put my notes that wasn’t <a href="http://iconocla.st/">my personal weblog</a>.</p>
<p><em>Insh’allah</em>, may you find what you seek here, as I have so often found what I
sought across the many poorly-written forum posts and antiquated blog entries
that span the wond’rous Internet. <em>Ave atque vale</em>, fellow traveller.</p>
]]></content>
</entry>
</feed>