diff options
author | William Carroll <wpcarro@gmail.com> | 2017-06-20T22·07-0400 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2017-06-20T22·07-0400 |
commit | 9d591e52ac6954d98e25bbf50f2a1e5c9b2b42b9 (patch) | |
tree | 7fa9150537fd7ede0ea5e86da3a61363631877b5 | |
parent | 8fbafc3a5cf6a16aff65ee87af243ec598b4c08f (diff) |
Adds GPG helper functions; Cleans index.sh
-rw-r--r-- | configs/.emacs | 6 | ||||
-rw-r--r-- | functions/gpg_functions.sh | 20 | ||||
-rw-r--r-- | functions/index.sh | 39 | ||||
-rw-r--r-- | functions/misc_functions.sh | 39 |
4 files changed, 59 insertions, 45 deletions
diff --git a/configs/.emacs b/configs/.emacs index e1c5e3dab521..5f4c753ff11f 100644 --- a/configs/.emacs +++ b/configs/.emacs @@ -326,7 +326,9 @@ (evil-ex-define-cmd (kbd "w") 'save-buffer-always) (add-hook 'prog-mode-hook 'evil-local-mode) (add-hook 'org-mode-hook 'evil-local-mode) - (add-hook 'markdown-mode-hook 'evil-local-mode)) + (add-hook 'markdown-mode-hook 'evil-local-mode) + (add-hook 'text-mode-hook 'evil-local-mode) + ) ;; Hack at the moment for extending the behavior of the jump to mark command @@ -486,7 +488,7 @@ (setq helm-imenu-fuzzy-match t) (setq helm-locate-fuzzy-match t) :config - (load "~/.emacs.d/wc-helm-functions.el") + (load "~/.emacs.d/wc-helm-functions.el")) ;; Helm Projectile Settings diff --git a/functions/gpg_functions.sh b/functions/gpg_functions.sh new file mode 100644 index 000000000000..ba0ad0503a86 --- /dev/null +++ b/functions/gpg_functions.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env zsh + +function gpg-encrypt-dir() { + dirname=$1 + tar -cz "$dirname" | gpg --symmetric --output "$dirname.tar.gz.gpg" +} + + +function gpg-decrypt-dir() { + dirname=$1 + outdir=${dirname%.tar.gz.gpg} + + if [ -d "$outdir" ]; then + echo "Output directory, $outdir, already exists and will be overwritten by this command. Aborting..." + exit 1 + else + gpg --decrypt $dirname | tar -xv + fi + +} diff --git a/functions/index.sh b/functions/index.sh index 524fbc2d1543..616599416594 100644 --- a/functions/index.sh +++ b/functions/index.sh @@ -1,9 +1,3 @@ -npms() { - clear; - npm start; -} - - # custom js functions source $HOME/pc_settings/functions/js_to_bash.sh @@ -19,34 +13,5 @@ source $HOME/pc_settings/functions/history_functions.sh # custom functions to work with vim source $HOME/pc_settings/functions/vim_functions.sh - -# generates placeholder content for FE work -function lorem { - text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." - - echo $text -} - -# generates lorem and adds to pasteboard -function loremcp { - lorem | pbcopy -} - -# searches all PATH directories for a keyword -function wsearchpath { - echo $PATH | tr ':' '\n' | xargs -I {} find {} -type f -perm +111 -maxdepth 1 -name "*${1}*" -print | xargs basename -} - - -# tests an internet connection -function is_online { - wget -q --spider "http://google.com" - - if [ $? -eq 0 ]; then - echo "Online" - return 0 - else - echo "Offline" - return 1 - fi -} +# custom functions to work with gpg +source $HOME/pc_settings/functions/gpg_functions.sh diff --git a/functions/misc_functions.sh b/functions/misc_functions.sh index 31b421065a48..a943573e5fd5 100644 --- a/functions/misc_functions.sh +++ b/functions/misc_functions.sh @@ -1,9 +1,3 @@ -# fuzzily-find-file -function wgff { - echo $(find . -type f | fzf-tmux) -} - - # fuzzily-find-branch function wgfb { echo $(git branch -a | fzf-tmux) @@ -79,3 +73,36 @@ function tt() { fi } + +# generates placeholder content for FE work +function lorem { + text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." + + echo $text +} + + +# generates lorem and adds to pasteboard +function loremcp { + lorem | pbcopy +} + + +# searches all PATH directories for a keyword +function wsearchpath { + echo $PATH | tr ':' '\n' | xargs -I {} find {} -type f -perm +111 -maxdepth 1 -name "*${1}*" -print | xargs basename +} + + +# tests an internet connection +function is_online { + wget -q --spider "http://google.com" + + if [ $? -eq 0 ]; then + echo "Online" + return 0 + else + echo "Offline" + return 1 + fi +} |