New Blog Posts template with Emacs
Created emacs Hakyll Templates for this blog, inspired by this StackOverflow post. Emacs plugs are written in lisp, which looks like the code below.
(defvar insight-blog-location "~/path/to/hakyll/blog"
"Return the location of my blog files.")
;; Takes 3 string inputs and autofills them to a new post.
(defun insight-blog-new-post (title tags bg)
"Create a new Hakyll post for today with TITLE and TAGS."
(interactive "sTitle: \nsTags: \nsheaderImg:")
(hakyll-do-write
(format "%s/%s-%s.md"
insight-blog-location
(format-time-string "%Y-%m-%d")
(replace-regexp-in-string " " "-" (downcase title)))
(format "---\ntitle: %s\ntags: %s\nheaderImg: %s\n---\n\n"
title
tags
bg)))
(defun hakyll-do-write (file-name str)
(find-file file-name)
(insert str)
(save-buffer))
This particular code says that when you type M-x (alt + x)
` on your keyboard, followed by insight-blog-new-post - you’ll get three prompts for input, namely: title, tags, and header image.
~*~
Ssh easy to remember server names
Instead of typing ssh [email protected], you can type in something easier to remember at the command line. An example command would be like, ssh niketown
. You can do this by settng your ssh config files.
vim ~/.ssh/config
add the following lines:
Host niketown
HostName 127.9.9.1
User root
For my 4 nodes, I have master, worker1, worker2, and worker3.