Pandoc-flavored markdown: Perfect!

I’d been looking for a way to convert my notes to webpages. Typically I wrote my notes in .txt form and then went through them and added links, formatting… when I was ready to blog them. Recently, I had asked StackOverflow if I could convert MediaWiki format to HTML. I’m an Administrator for the Arch Wiki so I’m very familiar writing this format. This is when I learned about pandoc. Pandoc’s author describes pandoc as, “If you need to convert files from one markup format into another, pandoc is your swiss-army knife…“.

Plain Text Example

I planned to write my notes in mediawiki format and then convert to HTML, however I’d been using StackOverflow lately and started to learn Markdown Prose and really like it. Markdown’s is designed to be easy to write and read: “Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)“. Markdown is so easy to write that it makes sense that sites like StackOverflow and GitHub are using it.

Markdown, Markup Languange

Pandoc has extended markdown to use code blocks ```, tables, and a few other things and converting is very basic:

pandoc -o file.htm

I’m in love, I’m in love, I’m in love :), as it will save me a good bit of time in editing/creating Documentation. Tomorrow, I’ll post a bash script to clean up the HTML to be able to put it in a WordPress Blog.


(ar)ch (pa)ckages – a generic package tasks script for Arch Linux

I once saw a wrapper-script for pacman in the forums that was basically a short-hand version of common pacman tasks. I thought this was a good idea and over the last couple years, I’ve expanded on it. It does just about everything I need it to. It’s real basic and I call it arpa. Here is a basic synopsis:

arpa [option] [*package] - a generic package tasks wrapper script
  -e, --explicit - install a package as explicit
  -g, --get      - get/download package upgrade(s)    : -G get pkg upgrades all
  -i, --install  - install a package                  : -I install as dependency
  -l, --list     - list package files                 : -L list pkgs installed
  -o, --owns     - owning package of a file
  -q, --query    - query for an installed package     : -Q query w/ description
  -r, --remove   - remove a pkg and its deps          : -R force, no argue orphs
  -s, --search   - search for a package               : -S search w/ description
  -u, --upgrade  - upgrade system                     : -U upgrade AUR
  -y, --sync     - sync package db

Good for me to have this around so I can remember everything :), and it is in the AUR.

Acer Aspire 5560G-7809 Laptop: A Gamble Worth Taking

Typically it hasn’t been recommended to buy an Acer, at least in my circles. From the surveys I’ve seen generally Acer rankings are last of the major computer manufacturers. Astonishingly they rank close to the top of units sold. When I saw this, I deduced that Acer likely made possibly shabby computers sold at basement-prices to a portion of the population that was virgin. So I’m not sure what I was thinking when I bought my Aspire laptop except, “If that’s true, thats a really good price; I have to have it.” I had been using a ten-year-old laptop up to now so this was by best shot to the moon orbit.

I heard about laptops that were “Desktop Replacements”. I was hoping to find something in that area: a powerful-ish core in a mobile unit (with a decent gaming card). I’m not sure the Aspire 5560G-7809 [1][2] would qualify as one officially but performance in Windows and Linux is good (at least as best as I can qualify from a 10-year-old laptop perspective). The basic specs:

Processor AMD A6-3420M Quad-core 1.50 GHz
Memory 4GB DDR3-1066/PC3-8500
Hard Drive 320 GB SATA 5400rpm
Optical Disk DVD-RAM/±R/±RW-Writer
Screen 15.6″ 1366 x 768 Glossy LED
Graphic Card Dual-Graphic -/AMD Radeon HD 7670M

All this for $550 dollars from TigerDirect. The closest comparable model was from HP for $750. I was really recommended to change the RAM speed so this was the first thing I did. Along with the laptop I bought a two stick pack of PC106-1333 8GB memory from PNY for $41 dollars only to have it be non-compatible (or I guess it could have been busted [but passed memory test]). After that I got it from crucial because of their Guaranteed-compatible promise and the speedup is noticeable.

I admit that I got the 5560G because of the graphic card to be able to play games, it was extremely appealing to me. The Notebookcheck tests on it seemed to me to be real good for a mobile graphic card. I was able to get into Dungeon and Dragons Online and the playability was good with the auto-detected medium-high graphic settings. Been thinking about SWTOR, hmm.

I’ll probably one day get a Solid state Drive down the road for it, the 5400 hard drive speed is definitely hard to miss at times. The one from crucial sounds pretty appealing, at $170 dollars though ughh, and I’m not sure I can live with 125GB.

The screen is nice and bright and seems to have good color replication though it does have a limited-gamut and viewing angle (a typical 1366 x 768 these days I’m told). It uses an LED which is nice; glossy, not so. Having it be so reflective worried me at first I was real surprised though when I turned it on how it made that shiny virtually indistinguishable.

Keyboard and touchpad feel good. The keyboard is full-size and key pushes offer an easy, uniform resistance. I really like the touchpad. The surface provides a nice bit of friction for feedback and the size fits really well. Wish manufacturers would get away from touchpad tapping on as default however (be nice if even there was a hardware way to turn it off).

The look and balance is nice as well (if you can’t tell the look from the photos). Doesn’t weigh too much and doesn’t feel off-kilter like other laptops I’ve experienced. The hinge is sturdy and pivots nicely.

Pluses and Minuses

  • + Price
  • + Graphic Card
  • – 5400rpm Hard Drive
  • – RAM Speed
  • – USB 2.0
  • ? USB port in front of DVD-writer


Site note first: I can’t believe I am saying it but I like Windows7. It’s well put together and has good help. Out of the box everything worked pretty well. What can I say though, I like hacking; plus I love open-source.

I’m not sure how I got so lucky buying this but after installing Linux everything just worked.

Arachnophilia: a Beautiful, Basic, Web Editor

Screenshot from 2014-02-13 06:31:55Update (2014-02-14): Since this post I’ve moved onto Bluefish because it has better support of tables. Bluefish has the ability for pre-defined tags with snippets ability… nice.

I’d just about tossed in the towel on finding an HTML editor that I felt comfortable with when I happened upon this: Arachnophilia; and now I not sure how I could be better off.

Arachnophilia isn’t technically a Linux program, rather it’s a Java program. I’ve avoided using Java programs until now because they ran slowly; however, Java seems to have come a long way from the earlier days and Arachnophilia runs decent, decent enough for me to use on a regular basis.

Arachnophilia is designed to allow direct access to numerous tags. The tags on the two toolbars include the most popular tags and more can be easily added. The library on the left lists a good number more tags. Just about everything is editable in Arachnophilia including the menus. The huge bonus too is that Arachnophilia allows creation of new user-created tags. With this program I’ve been able to create custom tags that I use with my blog.

There is no installing Arachnophilia, just downloading the Arachnophilia Java archive and then directing Java to start it (or if on a Debian system can use the .deb below):

java -jar Arachnophilia.jar

Arachnophilia is simple, plain and enjoyable to use and has easily become my default HTML editor. Thank you Paul Lutus for your work.


Geany Set Up as Just a Text Editor

I have lately decided to use Geany as my default text editor. Geany handles text kindly. For a basic person like me it behaves likewise (which I appreciate). Geany is a text editor with IDE features. To display only the text editor part, I had set up Geany before. I am writing it down now to remember the settings, and to share to those who might find it handy.


General:   Misc:  Always wrap search      check
                  Hide the find dialog    check  # Ctrl + (Shift) + G
Interface: Intr:  Show sidebar          uncheck
           Note:  Show close buttons    uncheck  # Ctrl + W
           Tool:  Show toolbar          uncheck  # a few shortcuts learn
Editor     Feat:  Line wrapping           check
                  Code folding          uncheck  # change later?
                  Line breaking column       80  # typical
           Indn:  Width                       2  # two is good for mult-indnt
           Dspl:  Show line numbers     uncheck  # status bar display
                  Show markers margin   uncheck  # seldom use
                  Long line marker           80
Files             Default EOL chars          LF
                  Ensure cons line end    check
                  Strip trailing s&t      check  # i remember easier

The message window I rarely use and can be turned off by doing View > Show Message Window and unchecking.

Key bindings useful to know

  ctrl + n            new
  ctrl + o            open
  ctrl + s            save
  ctrl + shift + s    save as   (added)
  ctrl + w            close
  ctrl + r            reload
  ctrl + z            undo
  ctrl + y            redo
  ctrl + d            line duplicate
  ctrl + k            line delete
  ctrl + shift + del  eol erase to
  ctrl + shift + bck  bol erase to
  alt  + ↑/↓          line scroll
  alt  + pgup/pgdn    line move
  ctrl + f            find
  ctrl + g            find again
  ctrl + shift + g    find previous
  ctrl + h            replace
go to:
  ctrl + l            line goto
  home                bol  # Left  override
  end                 eol  # right override
  ctrl + tab          tab next

Syntax Highlighting in Blog Posts with Vim

Update: Reader Elder Marco has pointed out that does have support for syntax highlighting of source code built-in (which I had never heard of before) that might be a preferred alternative for some. An example of both is below.

Vim is a great all-around editor, it also does very good at syntax highlighting. With the plugin “TOhtml” included with Vim it’s easy to put that highlighting into a blog post. I created a blogscrpt bash script that when run on another script will produce a file defining the syntax highlighting in HTML code. From there it can be pasted into the blog post.

blogscrpt syntax highlighting:

# Create HTML code from Vim syntax highlighting (for use in coloring scripts)

scrpt=${0##*/}  # filename of script

# Display usage if no parameters given
if [[ -z "$@" ]]; then
  echo " $scrpt <filename> - create HTML code from Vim syntax highlighting"

# Syntax highlighting to HTML export
vim -f  +"syntax on"                  \
        +"set background=$background" \
        +"colorscheme $colorscheme"   \
        +"let html_use_css = 0"       \
        +"let html_no_pre = 1"        \
        +"let html_number_lines = 0"  \
        +"TOhtml"                     \
        +"x"                          \
        +"q" $filename

# Clean up HTML code
tidy -utf8 -f /dev/null --wrap -m $filename.html

# Delete the HTML meta page information.
sed -i '1,/body bgcolor=/d' $filename.html

# Remove line breaks (needed for some things like blog posts)
sed -i 's|<br>||g' $filename.html

# Remove the closing HTML tags
sed -i 's~</body[^>]*>~~g' $filename.html
sed -i 's~</html[^>]*>~~g' $filename.html

# Add preformatting tabs <pre> and </pre>
#sed -i '1 i <pre>' $filename.html
#sed -i '$ a </pre>' $filename.html

# Remove trailing blank lines
while [ "$(tail -n 1 $filename.html)" == "\n" ]; do
  sed -i '$d' $filename.html

# Delete newline of last <font> line for better formatting
sed -i ':a;N;$!ba;s/\(.*\)\n/\1/' $filename.html
sed -i ':a;N;$!ba;s/\(.*\)\n/\1/' $filename.html

# Delete final newline
perl -i -e 'local $/; $_ = <>; s/\n$//; print' $filename.html

WordPress built-in syntax highlight support example:

# Create HTML code from Vim syntax highlighting (for use in coloring scripts)

scrpt=${0##*/}  # filename of script

# Display usage if no parameters given
if [[ -z "$@" ]]; then
  echo " $scrpt <filename> - create HTML code from Vim syntax highlighting"

# Syntax highlighting to HTML export
vim -f  +"syntax on"                  \
        +"set background=$background" \
        +"colorscheme $colorscheme"   \
        +"let html_use_css = 0"       \
        +"let html_no_pre = 1"        \
        +"let html_number_lines = 0"  \
        +"TOhtml"                     \
        +"x"                          \
        +"q" $filename

# Clean up HTML code
tidy -utf8 -f /dev/null --wrap -m $filename.html

# Delete the HTML meta page information.
sed -i '1,/body bgcolor=/d' $filename.html

# Remove line breaks (needed for some things like blog posts)
sed -i 's|<br>||g' $filename.html

# Remove the closing HTML tags
sed -i 's~</body[^>]*>~~g' $filename.html
sed -i 's~</html[^>]*>~~g' $filename.html

# Add preformatting tabs <pre> and </pre>
#sed -i '1 i <pre>' $filename.html
#sed -i '$ a </pre>' $filename.html

# Remove trailing blank lines
while [ "$(tail -n 1 $filename.html)" == "\n" ]; do
  sed -i '$d' $filename.html

# Delete newline of last <font> line for better formatting
sed -i ':a;N;$!ba;s/\(.*\)\n/\1/' $filename.html
sed -i ':a;N;$!ba;s/\(.*\)\n/\1/' $filename.html

# Delete final newline
perl -i -e 'local $/; $_ = <>; s/\n$//; print' $filename.html