Skip to content

Instantly share code, notes, and snippets.

View howardabrams's full-sized avatar

Howard Abrams howardabrams

View GitHub Profile
(defun remote-shell-fav-hosts-get ()
"My hook to the remote-shell processes in order to connect to
my OpenStack controller, and create a hashtable of host names as
the keys, and IP addresses as the values."
(interactive)
;; Run nova list command remotely on this host system, and put the
;; results in a temp buffer:
(let* ((undercloud-controller "10.98.1.145")
(default-directory (format "/ssh:%s:" undercloud-controller))
@howardabrams
howardabrams / knife.el
Last active December 10, 2016 11:22
Run Chef's knife command with ido completion
;;; KNIFE --- Runs Chef's knife command with ido completions
;;
;; Author: Howard Abrams <howard.abrams@gmail.com>
;; Copyright © 2016, Howard Abrams, all rights reserved.
;; Created: 11 July 2016
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
#+NAME: foobar-contents
#+begin_src emacs-lisp
(with-temp-buffer
(insert-file "/tmp/foobar")
(buffer-string))
#+end_src
#+RESULTS: foobar-contents
: Curabitur lacinia pulvinar nibh. Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus.
: Donec at pede. Curabitur lacinia pulvinar nibh. Nam euismod tellus id erat.

Tangling an org-mode file when the :tangle parameter is set to yes, writes each block into a single file based on a language and the name of the org file. In this case, my file is /tmp/example.org, so all Ruby blocks will be written into a single file, /tmp/example.rb. But this can be change as shown below.

Section One

For this example, the :tangle parameter is simply yes, which grabs the defaults:

echo In section one
#+TITLE: ${1:`(->> (buffer-file-name)
(file-name-base)
(s-split-words)
(--map (s-capitalize it))
(s-join " "))`}
#+AUTHOR: `user-full-name`
#+EMAIL: `user-mail-address`
#+DATE: `(format-time-string "%Y-%m-%d")`