ootput Burst on Github via Hexo

Thanks to Hexo, I am slowly migrating my wordpress.com site towards Github. Github Pages reminds me of Nanoblogger in many ways - sans the excruciating pace of deployment. I love Github’s free-of-ads hosting, and the fact that I can tinker with the content framework in the comfort of my beloved Emacs editor. I also don’t mind the fact that I work with a local repository of text-based version-controlled blog entries.

Check out my work-in-progress at http://ootput.github.io

Changes to vanilla Hexo are courtesy of fine Hexo documentation at http://jr0cket.co.uk/hexo/

Gist Extras in Habari

Gist Extras embeds gists in post content, and allows for the use of custom CSS.

Unfortunately, the author has not updated the plug-in for Habari 0.7 - where plug-in information now resides in a separate XML file. To address this, make the following changes to gistextras.plugin.php:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
*** user/plugins/gistextras/gistextras.plugin.php.orig 2010-06-26 22:11:59.777117173 +0800
--- user/plugins/gistextras/gistextras.plugin.php 2010-06-26 22:11:32.328366681 +0800
***************
*** 2,20 ****
class GistExtras extends Plugin
{
- public function info()
- {
- return array(
- 'url' => 'http://andrewhutchings.com',
- 'name' => 'Gist Extras',
- 'description' => 'Embeds gists in post content, and allows for the use of custom CSS.',
- 'license' => 'Apache License 2.0',
- 'author' => 'Andrew Hutchings',
- 'authorurl' => 'http://andrewhutchings.com',
- 'version' => '0.0.2'
- );
- }
-
public function action_update_check()
{
Update::add( 'GistExtras', 'A6A9D42C-2F4F-11DE-BB63-026155D89593', $this->info->version );
--- 2,7 ----

You’ll also need to create gistextras.plugin.xml:

1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="utf-8" ?>
<pluggable type="plugin">
<name>Gist Extras</name>
<license url="http://www.apache.org/licenses/LICENSE-2.0.html">Apache Software License 2.0</license>
<url>http://andrewhutchings.com</url>
<author url="http://andrewhutchings.com">Andrew Hutchings</author>
<version>0.0.2</version>
<description><![CDATA[Embeds gists in post content, and allows for the use of custom CSS.]]></description>
<copyright>2009</copyright>
</pluggable>

Github Gists in Habari

To avoid having wasted space in embedded gists, make the following changes to user/themes/k2/style.css:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
*** system/themes/k2/style.css 2010-06-21 22:15:10.587118909 +0800
--- user/themes/k2/style.css 2010-06-27 21:22:38.248366535 +0800
***************
*** 891,895 ****
--- 891,902 ----
border: 1px solid #999;
}
+ /*-
+ Github Gists
+ */
+
+ .gist { text-indent:0 !important; }
+ .gist-highlight { line-height: 1.2em !important;}
+
/* Peace and forgiveness */
/* Learn more about the other K2: http://en.wikipedia.org/wiki/K2 */

Upload Github Gists

To upload gists from the command-line, follow these instructions. The given usage example shows:

$ gist < file.txt
$ echo secret | gist --private # or -p
$ echo "puts :hi" | gist -t rb
$ gist script.py
$ gist script.js notes.txt
$ pbpaste | gist -p # Copy from clipboard - OSX Only
$ gist -
the quick brown fox jumps over the lazy dog
^D

Delete Github Repo via Curl

Github allows users to interact with their online profile (account details, repo details etc) via several APIs separate from the standard web-interface. This proves useful, if, say, you need to remove a problematic repo entirely from Github, and the web interface won’t let you access the repo page, citing error: page not found.

From the instructions given:

$ curl -F 'login=ootput' -F 'token=_API_TOKEN_HERE_' https://github.com/api/v2/json/repos/delete/_REPO_NAME_

(The API_TOKEN_HERE can be found in Account Settings, under Administrative Information.)

If the curl command succeeds, it will return something similar to {"delete_token":"abcdefgh"}. Use this token in the following:

$ curl -F 'login=ootput' -F 'token=_API_TOKEN_HERE_' -F 'delete_token=abcdefgh' https://github.com/api/v2/json/repos/delete/_REPO_NAME_

If all goes well, curl will return {"status":"deleted"}

You can use the -k (or --insecure) option for curl to bypass certificate verification.