Skip to content

Instantly share code, notes, and snippets.

View rawsyntax's full-sized avatar

Eric Himmelreich rawsyntax

View GitHub Profile
(defun toggle-eshell-visor ()
"Brings up a visor like eshell buffer, filling the entire emacs frame"
(interactive)
(if (string= "eshell-mode" (eval 'major-mode))
(jump-to-register :pre-eshell-visor-window-configuration)
(window-configuration-to-register :pre-eshell-visor-window-configuration)
(call-interactively 'eshell)
(delete-other-windows)))
@rawsyntax
rawsyntax / bindings.el
Created February 23, 2013 22:10
key bindings
(global-set-key (kbd "\C-cu") 'reset-ui)
(global-set-key (kbd "C-c t") 'toggle-eshell-visor)
@rawsyntax
rawsyntax / ui.el
Last active May 14, 2017 16:18
reset ui and toggle eshell visor
;;default display position/size based on display resolution
;;warning: assumption that the 24/22 " displays are oriented
;; above the laptop's display
;; Haven't found a way to check multiple monitor
;; relative orientation via emacs yet...
;;
;; a frame is passed in when firing on after-make-frame-fuctions,
;; but not necessary when calling interactively
(defun reset-ui (&optional frame)
(if frame
@rawsyntax
rawsyntax / magit-commit-template.el
Last active January 5, 2019 15:41
magit commit hook template
;; TODO: pull author initials from (user-full-name)
(setq author-initials "EH")
(defun set-pivotal-story-id (id)
"sets current pivotal tracker story id"
(interactive "spivotal-story-id:")
(progn
(setq pivotal-story-id id)))
#!/bin/bash
# I use this script, then also create an alias, for example:
# mkdir -p /Users/eric/Downloads/tv && rsync-retry.sh [email protected]:~/torrents/eric/bitmetv/ /Users/eric/Downloads/tv
### ABOUT: See: http://gist.github.com/366269
### Runs rsync, retrying on errors up to a maximum number of tries.
### On failure script waits for internect connection to come back up by pinging google.com before continuing.
###
### Usage: $ ./rsync-retry.sh source destination
@rawsyntax
rawsyntax / config
Created July 11, 2012 16:43
faster ssh
Host *
# don't try to authenticate with Kerberos
GSSAPIAuthentication no
GSSAPIKeyExchange no
# persist the ssh connection for 5 minutes
# subsequent ssh connections respond faster because its reusing an existing connection
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p
ControlPersist 5m
@rawsyntax
rawsyntax / init.el
Created June 11, 2012 21:01
setup elisp package manager
(require 'package)
;; optionally add the marmalade repo to list-packages
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
(package-refresh-contents)
(require 'smex)
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
(global-set-key (kbd "C-c M-x") 'smex-update)
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
@rawsyntax
rawsyntax / defuns.el
Created May 31, 2012 21:25
a scratch buffer for javascript
(defun scratch-js ()
"Create or switch to a javascript mode scratch buffer"
(interactive)
(if (not (eq nil (get-buffer "scratch-js")))
(switch-to-buffer "scratch-js")
(set-buffer (get-buffer-create "scratch-js"))
(js2-mode)
(switch-to-buffer "scratch-js")))
@rawsyntax
rawsyntax / js2-mode.el
Created May 31, 2012 21:19
js2-mode with better indentation
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.json$" . js2-mode))
;; Use js-mode indentation in js2-mode, I don't like js2-mode's indentation
;;
;; thanks http://mihai.bazon.net/projects/editing-javascript-with-emacs-js2-mode
;; with my own modifications
;;
(defun my-js2-indent-function ()