Skip to content

Instantly share code, notes, and snippets.

View howardabrams's full-sized avatar

Howard Abrams howardabrams

View GitHub Profile
#+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")`

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
#+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.
@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:
;;
(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))
;; I would like a function that inserts a phrase or paragraph into a
;; buffer, but that it is looks like it is being typed. This means to
;; have a slight, but random time delay between each letter. Calling
;; `sit-for' is sufficient for short sentences (around 140
;; characters), but anything longer makes the display look like it
;; hangs until some event, and then the entire results are displayed.
;;
;; Ideas or thoughts on what to look for?
(defun insert-typewriter (str)
;;; SAVE-HOOKS --- Folder Actions on Save
;;
;; Author: Howard Abrams <howard.abrams@gmail.com>
;; Copyright © 2015, Howard Abrams, all rights reserved.
;; Created: 18 March 2015
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;;; SAVE-HOOKS --- Folder Actions on Save
;;
;; Author: Howard Abrams <howard.abrams@gmail.com>
;; Copyright © 2015, Howard Abrams, all rights reserved.
;; Created: 18 March 2015
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
@howardabrams
howardabrams / keybase.md
Created April 9, 2014 04:30
Proof of my keybase.io credentials... you can ignore this.

Keybase proof

I hereby claim:

  • I am howardabrams on github.
  • I am howardabrams (https://keybase.io/howardabrams) on keybase.
  • I have a public key whose fingerprint is 2B03 9DE6 5EE1 161B 2807 3888 5B10 2887 E4B9 1525

To claim this, I am signing this object:

@howardabrams
howardabrams / surround-v2.el
Last active December 10, 2016 11:35
Now that we can easily make a region based on "syntactic components" using the `expand-region` command, wrapping a logical block of text with a beginning and ending string really makes sense. This "version" is more Emacs-y in that it `lets` all the variables, and then `setq` them to their proper values. While I'm not pedantic, I don't like such …
(defun surround (start end txt)
"Wraps the specified region (or the current 'symbol / word'
with some textual markers that this function requests from the
user. Opening-type text, like parens and angle-brackets will
insert the matching closing symbol.
This function also supports some org-mode wrappers:
- `#s` wraps the region in a source code block
- `#e` wraps it in an example block