The goal of efficiency is more slack.

Saturday, June 19, 2010

Blog from the command line

GoogleCL allows you to post to your Blogger blog from the command line. To install:
  1. Install Python gdata libraries. This entails downloading, untarring, and sudo python setup.py
  2. Install GoogleCL. Same as above.
  3. Copy googlecl-0.9.5/build/scripts-2.6/google (version numbers subject to change) to /usr/local/bin or anywhere else in you PATH.
Now you can open a terminal and run a command like:

google blogger post --tags "online, shell" --title "Frist post using GoogleCL" "Can you believe I'm posting this from the command line?"

Or write your post in a text editor, saving it as ~/tmp/post.html, then:

google blogger post --tags "online, shell" --title "Blog from the command line" ~/tmp/post.html

Thursday, June 10, 2010

Writing a TiddlyWiki plugin

It was easier than I thought to write a simple TiddlyWiki plugin. I wanted to create a shortcut for the "Close all" button on the sidebar.
  1. Hack (a backup of) the core TiddlyWiki html or javascript to make it do what you want. Take note of the functions or objects you edited.
  2. Copy the plugin template [TiddlyWiki.org].
  3. Paste the template into a new tiddler in a stock TiddlyWiki html (not the one you edited).
  4. File out the boilerplate stuff like the plugin's name and author.
  5. Override the functions or objects you noted in step 1 by writing code in !Code section of the tiddler.
  6. Add "systemConfig" to the tag field of the tiddler and save the tiddler.
  7. Save changes to the TiddlyWiki and refresh.
For your convenience, here's the plugin template. Be sure to replace SamplePlugin with the name of your plugin.

/***
|''Name''|SamplePlugin|
|''Description''|<...>|
|''Icon''|<...>|
|''Author''|<...>|
|''Contributors''|<...>|
|''Version''|<...>|
|''Date''|<...>|
|''Status''||
|''Source''|<...>|
|''CodeRepository''|<...>|
|''Copyright''|<...>|
|''License''|<...>|
|''CoreVersion''|<...>|
|''Requires''|<...>|
|''Overrides''|<...>|
|''Feedback''|<...>|
|''Documentation''|<...>|
|''Keywords''|<...>|
!Description
<...>
!Notes
<...>
!Usage
{{{
<>
}}}
!!Parameters
<...>
!!Examples
<>
!Configuration Options
<...>
!Revision History
!!v<#.#> ()
* <...>
!To Do
<...>
!Code
***/
//{{{
if(!version.extensions.SamplePlugin) { //# ensure that the plugin is only installed once
version.extensions.SamplePlugin = { installed: true };

if(!config.extensions) { config.extensions = {}; } //# obsolete from v2.4.2

config.extensions.SamplePlugin = {
sampleFunction: function() {
/* ... */
}
};

config.macros.SampleMacro = {
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
/* ... */
}
};

} //# end of "install only once"
//}}}

Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

Powered by Blogger.
Scroll To Top