Back to the Basics: Crayon, wp-LaTex, and vimWiki

Before I forget, I should review some of the basics.

So, this is a blog, and having your own blog requires some maintenance. It’s like owning a house except the servers are hosted in Arizona, the domain name is registered in France, and I guess you’re not owning said house. You’re renting hardware space in someone else’s basement.. Note where your local and remote machines are. Okay, so I need to remember how to bash function. How to bash function? No, how about just a bash alias?

alias alias_name="commandToRun"

while we’re at it

alias maketotaldestroy='sudo halt -p'

but the alias needs to be remembered after reboots

cd ~/
ls -la
vim .bash_aliases

include in file, continue with life.

source ~/.bash_aliases

So with this, instead of memorizing a very long username + host domain I can access my blog with only a few magic words.

alias sshblog='ssh forgettableLongName@ridiculouslyLongRemoteHostName.net'

.. checkmate. I guess we could include the password as an argument but, no. So long as remote and host have authenticated each other before, this ought to be enough.

Now, without needing to activate FTP we can update and modify everything in the blog via command line. Will need WP-CLI. Fortunately the freebsd log files kept track of the commands I issued to it oh so many seasons ago, so simply pressing the up arrow key and holding it for a minute or two sent me to the keystrokes. the magic keywords are simply:

wp help
wp help core
wp core check-update
wp core update
wp core update-db
wp core verify-checksums

wp help plugin
wp plugin update --all
wp plugin uninstall akismet
wp plugin uninstall hello

remove/deactivated unneeded plugins which could become hazardous to your health. For more information these functions have been well documented at http://wp-cli.org/docs/ or simply refer to the man pages

How to syntax on wp?

since we’re going to be typing code here and there, a nice plug-in to have is:
https://wordpress.org/plugins/crayon-syntax-highlighter/

from here we can simply dl to our own machine or even use SSH from the remote machine to dl the file from a selected URL https://downloads.wordpress.org/plugin/crayon-syntax-highlighter.zip and then save it to the remote machine’s plugin directory, then..

via wp-cli
search for “crayon” to get a list of plugins already available through official channels

wp plugin search crayon
wp plugin install crayon-syntax-highlighter
wp plugin activate crayon-syntax-highlighter

So now we have pretty colors that support languages beyond what the regular vanilla wordpress supports. you could also git clone or wget + unzip from https://github.com/aramk/crayon-syntax-highlighter.git to get the same affect, but we’re already using wp-cli to run an update so might as do it from the remote host.

Next order of business: LaTeX.. how to LaTeX?

simply typing in:

$latex i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>$

should produce:

$latex i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right> $

Unfortunately, I won’t get to see it until I preview it on the wordpress had it even worked to begin with. Apparently a viable plugin would need access to a latex server in order to generate some sort of image. It could be a .png and there’s even one that generates .svg vector images, but it pings to some guy’s web basement server and I’d rather not have my blog reliant on whether or not some random guy forgot to pay their electric bill. Of course, there’s always the option to self host a latex server on my own or a remote machine. A search for latex on the plugin menu yields several attempts at doing this.

While searching, I discovered an old .png generator for latex inputs. It seems to be not-so-old and the current method from which wordpress.com uses to render .png images. You can play around with the below URL.

https://s0.wp.com/latex.php?latex=i\hbar\frac{\partial}{\partial+t}\left|\Psi(t)\right>%3DH\left|\Psi(t)\right>\Psi(t hey type stuf in here and get a png)&bg=ffffff&fg=000&s=0

So, there’s a wordpress.org plug-in that utilizes a  similar, if not the exact same generator from wordpress.com. Note the distinction between the .com and .org service. It also has an option to generate from a self hosted server. Humm..

pro: less bandwidth
con: if access to wordpress.com goes down, image rendering capabilities go down with it. This will happen several times a year depending on who’s attacking the DNS.. but if the DNS is down this website will probably be inaccessible as well. Except in Australia. There’s a story to that.

To be reliant on external services.. Sure, to an extent.

wp plugin install wp-latex
wp plugin activate wp-latex

for more details: https://wordpress.org/plugins/wp-latex/faq/

how to vimwiki?

I’ve been reliant on gnote and random .txt files scattered around my drive to write down random things. A friend of mine recommended vimwiki, almost randomly like he had been reading my mind (or had shell access to my laptop).

vim remember.txt
remember to go through the ssh dot files and delete any weird pgp certs you don't recognize
:qw

The vimwiki is more of a plugin than anything, and should be easily installable through pathogen.

You can find the installation instructions here: https://github.com/tpope/vim-pathogen
and for vimwiki: https://vimwiki.github.io/

I shouldn’t need to go through writing the instructions here because the details are literally right there.

What I did need to figure out was that I was expected to make my own index.wiki file inside the ~/vimwiki/ folder. I was surprised when I could “enter” and “backspace” between files joined together by a link. #jawdrop.

:Vimwiki2HTML

creates a folder with a html transaction (along with a .css) of the page you’re on. It doesn’t follow through the nested links though. With maybe about a 100 functions on that help page, it’ll take a while to get acquainted with this program. I think it’s safe to say it has more functionality than what I had been previously using. I’ll play around with this for a few weeks and then decide if I’m better off with it.

What’s next? humm… I have less than 4 days to prep up on my Korean, toy around with some java, and I think they’ll be putting me in something about a “smarter cities” think group. I suspected it was related to the CES hackathon but that’s this weekend. I should probably go to that, but I need some ‘me’ time and me time includes prepping up on my Korean and toying around with some java. Also, my friend tells me I need to get more sunlight. I do.

[edit] Had been invited by some friends to join them at the CES hackathon this weekend, and despite making an attempt to print out my ticket, I just received an e-mail specifying that entrants needed to be registered for the CES portion by 7 days ago. This would be a separate registration process, and they’re only letting the first 450 people in. It’s fine. More ‘me’ time. Also,

convert -density 300 ticket.pdf -fill blue -opaque black ticketout.pdf

will attempt to change all your black pixels into blue ones in case your printer ran out of black ink. Sadly, I also just found out that we have a Kodak that refuses to print if it detects the black is low (or refuses to print black if it detects the color is low). Hardware should not be used like this against the consumer’s interest. Alternatively I could’ve gone to a UPS store or library that opens early to get something printed – mobile ticket barcodes ftw.

On a lighter note, I finally received the schedule for the Ajou workshop on Monday, so it looks like I’m slowly placing things on that to do list.