diff --git a/bash/.bashrc b/bash/.bashrc index 649b2bd..4588499 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -166,6 +166,9 @@ source "$OSH"/oh-my-bash.sh # users are encouraged to define aliases within the OSH_CUSTOM folder. # For a full list of active aliases, run ` +# export EDITOR="emacs -nw" +# export VISUAL="emacs" + alias ls='ls --color=auto --group-directories-first' # Replace grep command tool diff --git a/emacs/.emacs.d/lisp/tools/completion.el b/emacs/.emacs.d/lisp/tools/completion.el index 5428134..957e151 100644 --- a/emacs/.emacs.d/lisp/tools/completion.el +++ b/emacs/.emacs.d/lisp/tools/completion.el @@ -27,6 +27,14 @@ :config (setq flycheck-check-syntax-automatically '(save mode-enabled))) +;; Snippets +(use-package yasnippet + :ensure t + :config + (setq yas/root-directory + (list "~/.emacs.d/snippets") yas-indent-line 'fixed) + (yas-global-mode)) + (provide 'completion) ;;; completion.el ends here diff --git a/emacs/.emacs.d/snippets/go-mode/main b/emacs/.emacs.d/snippets/go-mode/main new file mode 100644 index 0000000..9a3ebe5 --- /dev/null +++ b/emacs/.emacs.d/snippets/go-mode/main @@ -0,0 +1,3 @@ +func main() { + $0 +} diff --git a/emacs/.emacs.d/snippets/go-mode/pr b/emacs/.emacs.d/snippets/go-mode/pr new file mode 100644 index 0000000..ea23f54 --- /dev/null +++ b/emacs/.emacs.d/snippets/go-mode/pr @@ -0,0 +1 @@ +fmt.Printf("%v\n", $0) diff --git a/emacs/.emacs.d/snippets/go-mode/tt b/emacs/.emacs.d/snippets/go-mode/tt new file mode 100644 index 0000000..a0ec037 --- /dev/null +++ b/emacs/.emacs.d/snippets/go-mode/tt @@ -0,0 +1,23 @@ +func Test$0 { + tests := []struct { + name string + req string + expected string + }{ + { + name: "happy path", + req: "answer to life, the universe and everything" + expected: "42" + } + } + + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + actual := foo(t, tt.req) + assertEquals(t, tt.want, expected) + }) + + } +} diff --git a/emacs/.emacs.d/snippets/java-mode/author b/emacs/.emacs.d/snippets/java-mode/author new file mode 100644 index 0000000..5070312 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/author @@ -0,0 +1,3 @@ +#name : author +# -- +@author Torstein Krause Johansen$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/java-mode/debug b/emacs/.emacs.d/snippets/java-mode/debug new file mode 100644 index 0000000..7d0152e --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/debug @@ -0,0 +1,6 @@ +#name : debug +# -- +if (mLogger.isDebugEnabled()) { + mLogger.debug(String.format("${1:result}=%s", ${2:result})); +} +$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/java-mode/dwmain b/emacs/.emacs.d/snippets/java-mode/dwmain new file mode 100644 index 0000000..a229496 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/dwmain @@ -0,0 +1,31 @@ +#name : dwmain +# -- +package ${1:net.skybert.dw}; + +import io.dropwizard.Application; +import io.dropwizard.assets.AssetsBundle; +import io.dropwizard.configuration.SubstitutingSourceProvider; +import io.dropwizard.jetty.ConnectorFactory; +import io.dropwizard.jetty.HttpConnectorFactory; +import io.dropwizard.lifecycle.Managed; +import io.dropwizard.server.DefaultServerFactory; +import io.dropwizard.setup.Bootstrap; +import io.dropwizard.setup.Environment; + +/** + * Main + */ +public class Main extends Application<${2:SkybertConf}> { + + public static void main(final String[] args) throws Exception { + new Main().run(args); + } + + @Override + public void run( + final $2 pConfiguration, + final Environment pEnvironment) + throws Exception { + $0 + } +} diff --git a/emacs/.emacs.d/snippets/java-mode/fn b/emacs/.emacs.d/snippets/java-mode/fn new file mode 100644 index 0000000..8fe5cc4 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/fn @@ -0,0 +1,5 @@ +#name : new method/function +# -- +${1:public} ${2:void} ${3:update}(final ${4:String} ${5:pName}) { + $0 +} diff --git a/emacs/.emacs.d/snippets/java-mode/for b/emacs/.emacs.d/snippets/java-mode/for new file mode 100644 index 0000000..c093ba7 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/for @@ -0,0 +1,5 @@ +#name : for (...; ...; ...) { ... } +# -- +for (${1:Object} ${downcase-word 1} ; ${2:list}) { + $0 +} diff --git a/emacs/.emacs.d/snippets/java-mode/fori b/emacs/.emacs.d/snippets/java-mode/fori new file mode 100644 index 0000000..a9e4ccc --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/fori @@ -0,0 +1,5 @@ +#name : for loop with index +# -- +for (int ${1:i} = 0; $1 < ${2:args.length}; $1${3:++}) { + $0 +} diff --git a/emacs/.emacs.d/snippets/java-mode/gse b/emacs/.emacs.d/snippets/java-mode/gse new file mode 100644 index 0000000..cd4763f --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/gse @@ -0,0 +1,13 @@ +#name : get/set/member variable +# -- +private ${1:String} ${2:name}; + +public void set${2:$(capitalize text)}(final $1 p${2:$(capitalize text)}) { + $2 = p${2:$(capitalize text)}; +} + +public $1 get${2:$(capitalize text)}() { + return $2; +} +$0 + diff --git a/emacs/.emacs.d/snippets/java-mode/if b/emacs/.emacs.d/snippets/java-mode/if new file mode 100644 index 0000000..59f1d0b --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/if @@ -0,0 +1,6 @@ +#name : if +# -- +if (${1:result} ${2:!=} ${3:null}) { + $0 +} + diff --git a/emacs/.emacs.d/snippets/java-mode/iisblank b/emacs/.emacs.d/snippets/java-mode/iisblank new file mode 100644 index 0000000..87ee357 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/iisblank @@ -0,0 +1,4 @@ +#name : static import of isBlank +# -- +import static org.apache.commons.lang.StringUtils.isBlank; +$0 diff --git a/emacs/.emacs.d/snippets/java-mode/junitwrapperfns b/emacs/.emacs.d/snippets/java-mode/junitwrapperfns new file mode 100644 index 0000000..6492450 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/junitwrapperfns @@ -0,0 +1,21 @@ +#name : junitwrapperfns +# -- + private void assertTrue(final String pMessage, final boolean pConditition) { + Assertions.assertTrue(pConditition, pMessage); + } + + private void assertFalse(final String pMessage, final boolean pConditition) { + Assertions.assertFalse(pConditition, pMessage); + } + + private void assertNotNull(final String pMessage, final Object pActual) { + Assertions.assertNotNull(pActual, pMessage); + } + + private void assertNull(final String pMessage, final Object pActual) { + Assertions.assertNull(pActual, pMessage); + } + + private void assertEquals(final String pMessage, final Object pExpected, final Object pActual) { + Assertions.assertEquals(pExpected, pActual, pMessage); + } diff --git a/emacs/.emacs.d/snippets/java-mode/main b/emacs/.emacs.d/snippets/java-mode/main new file mode 100644 index 0000000..c9ab3da --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/main @@ -0,0 +1,5 @@ +#name : main +# -- +public static void main(String[] args) { + $0 +} diff --git a/emacs/.emacs.d/snippets/java-mode/np b/emacs/.emacs.d/snippets/java-mode/np new file mode 100644 index 0000000..c7ea65f --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/np @@ -0,0 +1,3 @@ +#name : np +# -- + // NOPMD \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/java-mode/ol b/emacs/.emacs.d/snippets/java-mode/ol new file mode 100644 index 0000000..18e8e9a --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/ol @@ -0,0 +1,3 @@ +#name : get ObjectLoader +# -- +$0ObjectLoader objectLoader = IOAPI.getAPI().getObjectLoader(); diff --git a/emacs/.emacs.d/snippets/java-mode/req b/emacs/.emacs.d/snippets/java-mode/req new file mode 100644 index 0000000..fba51a7 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/req @@ -0,0 +1,6 @@ +#name : req +# -- +HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create($0)) + .timeout(Duration.ofMillis(getResponseTimeout())) + .build(); diff --git a/emacs/.emacs.d/snippets/java-mode/res b/emacs/.emacs.d/snippets/java-mode/res new file mode 100644 index 0000000..d41f495 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/res @@ -0,0 +1,3 @@ +#name : res +# -- +HttpResponse response = mHttpClient.send(request, ofString());$0 diff --git a/emacs/.emacs.d/snippets/java-mode/sf b/emacs/.emacs.d/snippets/java-mode/sf new file mode 100644 index 0000000..08a8196 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/sf @@ -0,0 +1,3 @@ +#name : sf +# -- +String.format("%s", $0) \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/java-mode/sop b/emacs/.emacs.d/snippets/java-mode/sop new file mode 100644 index 0000000..309282b --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/sop @@ -0,0 +1,3 @@ +#name : System.out.println +# -- +System.out.println($0); \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/java-mode/test b/emacs/.emacs.d/snippets/java-mode/test new file mode 100644 index 0000000..1f87026 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/test @@ -0,0 +1,4 @@ +@Test +void ${1:can}() throws Exception { + $0 +} \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/java-mode/tryf b/emacs/.emacs.d/snippets/java-mode/tryf new file mode 100644 index 0000000..da1cf19 --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/tryf @@ -0,0 +1,12 @@ +#name : try, catch & finally +# -- +try { + $0 +} +catch (${1:Exception} ${2:e}) { + mLogger.error($2); +} +finally { + +} + diff --git a/emacs/.emacs.d/snippets/java-mode/tyc b/emacs/.emacs.d/snippets/java-mode/tyc new file mode 100644 index 0000000..2faecee --- /dev/null +++ b/emacs/.emacs.d/snippets/java-mode/tyc @@ -0,0 +1,8 @@ +#name : try & catch +# -- +try { + $0 +} +catch (${1:Exception} ${2:e}) { + mLogger.error($2); +} diff --git a/emacs/.emacs.d/snippets/js2-mode/a b/emacs/.emacs.d/snippets/js2-mode/a new file mode 100644 index 0000000..7955bfe --- /dev/null +++ b/emacs/.emacs.d/snippets/js2-mode/a @@ -0,0 +1,4 @@ +#name : new array +# -- +var ${1:myArray} = new Array(); +$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/js2-mode/fn b/emacs/.emacs.d/snippets/js2-mode/fn new file mode 100644 index 0000000..7ca699e --- /dev/null +++ b/emacs/.emacs.d/snippets/js2-mode/fn @@ -0,0 +1,6 @@ +#name : function +# -- +function ${1:test}(${2:pValue}) { + $0 +} + diff --git a/emacs/.emacs.d/snippets/js2-mode/for b/emacs/.emacs.d/snippets/js2-mode/for new file mode 100644 index 0000000..407bc93 --- /dev/null +++ b/emacs/.emacs.d/snippets/js2-mode/for @@ -0,0 +1,5 @@ +#name : for (...; ...; ...) { ... } +# -- +for (var ${1:i} = 0; $1 < ${2:args.length}; $1${3:++}) { + $0 +} diff --git a/emacs/.emacs.d/snippets/js2-mode/if b/emacs/.emacs.d/snippets/js2-mode/if new file mode 100644 index 0000000..71803a5 --- /dev/null +++ b/emacs/.emacs.d/snippets/js2-mode/if @@ -0,0 +1,6 @@ +#name : if +# -- +if (${1:s} == ${2:undefined}) { + $0 +} + diff --git a/emacs/.emacs.d/snippets/js2-mode/log b/emacs/.emacs.d/snippets/js2-mode/log new file mode 100644 index 0000000..0cb9cfb --- /dev/null +++ b/emacs/.emacs.d/snippets/js2-mode/log @@ -0,0 +1,3 @@ +#name : log +# -- +console.log("$0"); diff --git a/emacs/.emacs.d/snippets/markdown-mode/a b/emacs/.emacs.d/snippets/markdown-mode/a new file mode 100644 index 0000000..381f971 --- /dev/null +++ b/emacs/.emacs.d/snippets/markdown-mode/a @@ -0,0 +1,3 @@ +#name : a +# -- +[${1}](${2})${0} diff --git a/emacs/.emacs.d/snippets/markdown-mode/img b/emacs/.emacs.d/snippets/markdown-mode/img new file mode 100644 index 0000000..2ec7f6d --- /dev/null +++ b/emacs/.emacs.d/snippets/markdown-mode/img @@ -0,0 +1,9 @@ +#name : img snippet +# -- + +${2:alt img text} +$0 diff --git a/emacs/.emacs.d/snippets/markdown-mode/me b/emacs/.emacs.d/snippets/markdown-mode/me new file mode 100644 index 0000000..584a308 --- /dev/null +++ b/emacs/.emacs.d/snippets/markdown-mode/me @@ -0,0 +1,3 @@ +# name : me +# -- +[@skybert](https://skybert.net) ${1:says:}$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/markdown-mode/pa b/emacs/.emacs.d/snippets/markdown-mode/pa new file mode 100644 index 0000000..466db7c --- /dev/null +++ b/emacs/.emacs.d/snippets/markdown-mode/pa @@ -0,0 +1,17 @@ +#name : pelican article +# -- +title: ${1:`(s-replace "-" " " (file-name-base (buffer-file-name)))`} +date: ${2:`(format-time-string "%Y-%m-%d" (current-time))`} +category: ${3:`(file-name-nondirectory + (substring + (file-name-directory (buffer-file-name)) + 0 + (- (length (file-name-directory (buffer-file-name))) 1) + ))`} +tags: ${4:`(file-name-nondirectory + (substring + (file-name-directory (buffer-file-name)) + 0 + (- (length (file-name-directory (buffer-file-name))) 1) + ))`} +$0 diff --git a/emacs/.emacs.d/snippets/markdown-mode/src b/emacs/.emacs.d/snippets/markdown-mode/src new file mode 100644 index 0000000..4743ab2 --- /dev/null +++ b/emacs/.emacs.d/snippets/markdown-mode/src @@ -0,0 +1,6 @@ +#name : src code snippet +# -- + +\`\`\`${1:text} +$0 +\`\`\` diff --git a/emacs/.emacs.d/snippets/markdown-mode/st b/emacs/.emacs.d/snippets/markdown-mode/st new file mode 100644 index 0000000..7144005 --- /dev/null +++ b/emacs/.emacs.d/snippets/markdown-mode/st @@ -0,0 +1,4 @@ +#name : strong element +# -- + +${1:text}$0 diff --git a/emacs/.emacs.d/snippets/nxml-mode/cdata b/emacs/.emacs.d/snippets/nxml-mode/cdata new file mode 100644 index 0000000..457f6a1 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/cdata @@ -0,0 +1,3 @@ +#name: cdata +# -- + \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/nxml-mode/cha b/emacs/.emacs.d/snippets/nxml-mode/cha new file mode 100644 index 0000000..3190557 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/cha @@ -0,0 +1,8 @@ +#name : cha +# -- + + ${1:My Title} + + $0 + + diff --git a/emacs/.emacs.d/snippets/nxml-mode/dep b/emacs/.emacs.d/snippets/nxml-mode/dep new file mode 100644 index 0000000..15c448c --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/dep @@ -0,0 +1,7 @@ +#name : dep +# -- + + $1 + $2 + $0 + diff --git a/emacs/.emacs.d/snippets/nxml-mode/diary b/emacs/.emacs.d/snippets/nxml-mode/diary new file mode 100644 index 0000000..83d13b7 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/diary @@ -0,0 +1,10 @@ +#name : diary +# -- + +

$1

+
+

+ $0 +

+
+ diff --git a/emacs/.emacs.d/snippets/nxml-mode/exclusion b/emacs/.emacs.d/snippets/nxml-mode/exclusion new file mode 100755 index 0000000..2d6c700 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/exclusion @@ -0,0 +1,6 @@ +#name : exclusion +# -- + + $1 + $2 +$0 diff --git a/emacs/.emacs.d/snippets/nxml-mode/exclusions b/emacs/.emacs.d/snippets/nxml-mode/exclusions new file mode 100644 index 0000000..cb51a7f --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/exclusions @@ -0,0 +1,8 @@ +#name : exclusions +# -- + + + $1 + $2 + $0 + diff --git a/emacs/.emacs.d/snippets/nxml-mode/incvar b/emacs/.emacs.d/snippets/nxml-mode/incvar new file mode 100644 index 0000000..c287b58 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/incvar @@ -0,0 +1,3 @@ +#name : incvar +# -- +$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/nxml-mode/list b/emacs/.emacs.d/snippets/nxml-mode/list new file mode 100644 index 0000000..20e0290 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/list @@ -0,0 +1,10 @@ +#name : list +# -- + + + + $0 + + + + diff --git a/emacs/.emacs.d/snippets/nxml-mode/listi b/emacs/.emacs.d/snippets/nxml-mode/listi new file mode 100644 index 0000000..98a8747 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/listi @@ -0,0 +1,4 @@ +#name : listi +# -- +$0 + diff --git a/emacs/.emacs.d/snippets/nxml-mode/lit b/emacs/.emacs.d/snippets/nxml-mode/lit new file mode 100644 index 0000000..3633b6d --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/lit @@ -0,0 +1,3 @@ +#name : lit +# -- +$0 diff --git a/emacs/.emacs.d/snippets/nxml-mode/oli b/emacs/.emacs.d/snippets/nxml-mode/oli new file mode 100644 index 0000000..7e6ae50 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/oli @@ -0,0 +1,5 @@ +#name : ol with a li +# -- +
    +
  1. $0
  2. +
diff --git a/emacs/.emacs.d/snippets/nxml-mode/para b/emacs/.emacs.d/snippets/nxml-mode/para new file mode 100644 index 0000000..e6ad40c --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/para @@ -0,0 +1,5 @@ +#name : para +# -- + + $0 + diff --git a/emacs/.emacs.d/snippets/nxml-mode/prog b/emacs/.emacs.d/snippets/nxml-mode/prog new file mode 100644 index 0000000..0a7fc97 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/prog @@ -0,0 +1,4 @@ +#name : prog +# -- + diff --git a/emacs/.emacs.d/snippets/nxml-mode/scr b/emacs/.emacs.d/snippets/nxml-mode/scr new file mode 100644 index 0000000..e94e94e --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/scr @@ -0,0 +1,5 @@ +#name : insert a JS tag without src +# -- + diff --git a/emacs/.emacs.d/snippets/nxml-mode/scri b/emacs/.emacs.d/snippets/nxml-mode/scri new file mode 100644 index 0000000..2740be7 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/scri @@ -0,0 +1,4 @@ +#name : insert a JS tag with src +# -- + +$0 diff --git a/emacs/.emacs.d/snippets/nxml-mode/sec b/emacs/.emacs.d/snippets/nxml-mode/sec new file mode 100644 index 0000000..e11eafd --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/sec @@ -0,0 +1,8 @@ +#name : sec +# -- +
+ ${1:My Title} + + $0 + +
diff --git a/emacs/.emacs.d/snippets/nxml-mode/uli b/emacs/.emacs.d/snippets/nxml-mode/uli new file mode 100644 index 0000000..7633341 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/uli @@ -0,0 +1,5 @@ +#name : ul with a li +# -- + diff --git a/emacs/.emacs.d/snippets/nxml-mode/varece b/emacs/.emacs.d/snippets/nxml-mode/varece new file mode 100644 index 0000000..9de4812 --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/varece @@ -0,0 +1,3 @@ +#name : varece +# -- + diff --git a/emacs/.emacs.d/snippets/nxml-mode/xlink b/emacs/.emacs.d/snippets/nxml-mode/xlink new file mode 100644 index 0000000..17d9f3e --- /dev/null +++ b/emacs/.emacs.d/snippets/nxml-mode/xlink @@ -0,0 +1,4 @@ +#name : xlink +# -- +$2 +$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/org-mode/code b/emacs/.emacs.d/snippets/org-mode/code new file mode 100644 index 0000000..2bc8342 --- /dev/null +++ b/emacs/.emacs.d/snippets/org-mode/code @@ -0,0 +1,5 @@ +#name : insert a Confluence code block +# -- +{code} +$0 +{code} diff --git a/emacs/.emacs.d/snippets/org-mode/daily b/emacs/.emacs.d/snippets/org-mode/daily new file mode 100644 index 0000000..8c0b19e --- /dev/null +++ b/emacs/.emacs.d/snippets/org-mode/daily @@ -0,0 +1,21 @@ +#name: daily +# -- +* ❯ Admin, training & maintenance +** DEVTR-1 Meetings, email, Slack++ +** DEVTR-5 System Maintenance +** DEVTR-6 Software Delivery +** DEVTR-8 Training + +* ❯ Coding + +* ❯ Review + +* ❯ Specification + +* ❯ Support +** DEVTR-3 PSERV Assistance +** DEVTR-5 Helping out colleagues in R&D + +* ❯ Report + #+BEGIN: clocktable :maxlevel 2 + #+END: diff --git a/emacs/.emacs.d/snippets/org-mode/gr b/emacs/.emacs.d/snippets/org-mode/gr new file mode 100644 index 0000000..d824db0 --- /dev/null +++ b/emacs/.emacs.d/snippets/org-mode/gr @@ -0,0 +1 @@ +** TODO DEVTR-44 Review - $0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/org-mode/q b/emacs/.emacs.d/snippets/org-mode/q new file mode 100644 index 0000000..cb2985e --- /dev/null +++ b/emacs/.emacs.d/snippets/org-mode/q @@ -0,0 +1,5 @@ +#name : insert a quote +# -- +#+begin_quote +$0 +#+end_quote diff --git a/emacs/.emacs.d/snippets/org-mode/src b/emacs/.emacs.d/snippets/org-mode/src new file mode 100644 index 0000000..47e85b6 --- /dev/null +++ b/emacs/.emacs.d/snippets/org-mode/src @@ -0,0 +1,5 @@ +#name : insert a source (BASH) declaration +# -- +#+begin_src markdown +$0 +#+end_src diff --git a/emacs/.emacs.d/snippets/org-mode/title b/emacs/.emacs.d/snippets/org-mode/title new file mode 100644 index 0000000..b485156 --- /dev/null +++ b/emacs/.emacs.d/snippets/org-mode/title @@ -0,0 +1 @@ +#+title: $0 diff --git a/emacs/.emacs.d/snippets/python-mode/app b/emacs/.emacs.d/snippets/python-mode/app new file mode 100644 index 0000000..bb26c08 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/app @@ -0,0 +1,4 @@ +#name : app +# -- +app = $1(__name__) +$0 diff --git a/emacs/.emacs.d/snippets/python-mode/def b/emacs/.emacs.d/snippets/python-mode/def new file mode 100644 index 0000000..a9dea7d --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/def @@ -0,0 +1,4 @@ +#name : def +# -- +def $1($2): + $0 diff --git a/emacs/.emacs.d/snippets/python-mode/im b/emacs/.emacs.d/snippets/python-mode/im new file mode 100644 index 0000000..54bb82f --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/im @@ -0,0 +1,4 @@ +#name : im +# -- +from $1 import $2 +$0 diff --git a/emacs/.emacs.d/snippets/python-mode/imflask b/emacs/.emacs.d/snippets/python-mode/imflask new file mode 100644 index 0000000..a78d6f0 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/imflask @@ -0,0 +1,6 @@ +#name : imflask +# -- +from flask import Flask +from flask import render_template +from requests import get +$0 diff --git a/emacs/.emacs.d/snippets/python-mode/main b/emacs/.emacs.d/snippets/python-mode/main new file mode 100644 index 0000000..998ffa4 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/main @@ -0,0 +1,4 @@ +#name : main +# -- +if __name__ == "__main__": + $0 diff --git a/emacs/.emacs.d/snippets/python-mode/p b/emacs/.emacs.d/snippets/python-mode/p new file mode 100644 index 0000000..1e85585 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/p @@ -0,0 +1,6 @@ +#name : Create @property function +# -- +@property +def $1(self): + return self._$1 +$0 diff --git a/emacs/.emacs.d/snippets/python-mode/pr b/emacs/.emacs.d/snippets/python-mode/pr new file mode 100644 index 0000000..7b56f04 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/pr @@ -0,0 +1,4 @@ +#name : pr +# -- +print($1) +$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/python-mode/prx b/emacs/.emacs.d/snippets/python-mode/prx new file mode 100644 index 0000000..cea39cc --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/prx @@ -0,0 +1,4 @@ +#name : prx +# -- +print(etree.tostring($1, encoding='unicode')) +$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/python-mode/render b/emacs/.emacs.d/snippets/python-mode/render new file mode 100644 index 0000000..2f96572 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/render @@ -0,0 +1,3 @@ +#name : render +# -- +return render_template("$1", data=$2) diff --git a/emacs/.emacs.d/snippets/python-mode/route b/emacs/.emacs.d/snippets/python-mode/route new file mode 100644 index 0000000..6cae423 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/route @@ -0,0 +1,5 @@ +#name : route +# -- +@app.route("/<$1>$2") +def $3($1): + $0 diff --git a/emacs/.emacs.d/snippets/python-mode/route2 b/emacs/.emacs.d/snippets/python-mode/route2 new file mode 100644 index 0000000..23f7002 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/route2 @@ -0,0 +1,5 @@ +#name : route +# -- +@app.route("/<$1>/<$2>$3") +def $4($1, $2): + $0 diff --git a/emacs/.emacs.d/snippets/rego-mode/package b/emacs/.emacs.d/snippets/rego-mode/package new file mode 100644 index 0000000..62feaf5 --- /dev/null +++ b/emacs/.emacs.d/snippets/rego-mode/package @@ -0,0 +1 @@ +package ${1:`(replace-regexp-in-string "/" "." (file-name-directory (buffer-file-name)))`}$0 diff --git a/emacs/.emacs.d/snippets/rego-mode/pr b/emacs/.emacs.d/snippets/rego-mode/pr new file mode 100644 index 0000000..e90a4ea --- /dev/null +++ b/emacs/.emacs.d/snippets/rego-mode/pr @@ -0,0 +1 @@ +print("$1", $2)$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/sh-mode/args b/emacs/.emacs.d/snippets/sh-mode/args new file mode 100644 index 0000000..3a5418b --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/args @@ -0,0 +1,44 @@ +#key: args +# -- + +read_user_input() { + local opts= + opts=$(getopt \ + -o hr:nv \ + --long help \ + --long version: \ + --long dry-run \ + --long verbose \ + -n 'parse-options' \ + -- "$@") + if [ $? != 0 ] ; then + echo "Failed parsing options." >&2 + exit 1 + fi + eval set -- "$opts" + + while true; do + case "\$1" in + -h | --help) + print_help; + exit 0 + break;; + -r | --version) + export version=\$2 + shift 2;; + -n | --dry-run) + export dry_run=1 + shift;; + -v | --verbose) + export verbose=1 + shift;; + -- ) + shift; + break ;; + * ) + break ;; + esac + done + + export rest_of_args=$* +} \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/sh-mode/aw b/emacs/.emacs.d/snippets/sh-mode/aw new file mode 100644 index 0000000..a937976 --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/aw @@ -0,0 +1,3 @@ +#name: aw +# -- +awk '{print \$${1:1}\}'$0 diff --git a/emacs/.emacs.d/snippets/sh-mode/cmd b/emacs/.emacs.d/snippets/sh-mode/cmd new file mode 100644 index 0000000..d11b9ce --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/cmd @@ -0,0 +1,18 @@ +#name : cmd +# -- +#! /usr/bin/env bash + +## author: torstein, torstein@skybert.net + +set -o errexit +set -o nounset +set -o pipefail + +main() { + : +} + +main "$@" + + + diff --git a/emacs/.emacs.d/snippets/sh-mode/cwd b/emacs/.emacs.d/snippets/sh-mode/cwd new file mode 100644 index 0000000..4716dd8 --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/cwd @@ -0,0 +1,5 @@ +#name: cwd +# -- +local _cwd= +_cwd="$(cd "\$(dirname "\${BASH_SOURCE[0]}")" &> /dev/null && pwd)" +$0 diff --git a/emacs/.emacs.d/snippets/sh-mode/eof b/emacs/.emacs.d/snippets/sh-mode/eof new file mode 100644 index 0000000..3f459ec --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/eof @@ -0,0 +1,5 @@ +#name : eof +# -- +cat < /dev/null && pwd)" + +## @override shunit2 +setUp() { + source "\${cwd}/../lib/$(basename "\$0" -test.sh)-lib.sh" +} + +## @override shunit2 +tearDown() { + : +} + +main() { + test -d "\${cwd}"/shunit2 || { + git -C "\${cwd}" clone --quiet --depth 1 https://github.com/kward/shunit2.git + } + + source "\${cwd}"/shunit2/shunit2 +} + +main "\$@" diff --git a/emacs/.emacs.d/snippets/sh-mode/test b/emacs/.emacs.d/snippets/sh-mode/test new file mode 100644 index 0000000..2dcc552 --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/test @@ -0,0 +1,21 @@ +#name : test +# -- +#! /usr/bin/env bash + +## author: torstein, torstein@skybert.net + +## @override shunit2 +setUp() { + source "$(dirname "\$0")/../lib/$(basename "\$0" -test.sh).sh" +} + +## @override shunit2 +tearDown() { + : +} + +main() { + . "$(dirname "\$0")"/shunit2/shunit2 +} + +main "$@" diff --git a/emacs/.emacs.d/snippets/sh-mode/tmpdir b/emacs/.emacs.d/snippets/sh-mode/tmpdir new file mode 100644 index 0000000..1bd3508 --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/tmpdir @@ -0,0 +1,8 @@ +#name : tmpdir +# -- +local ${1:tmp_dir}= +$1=\$(mktemp -d) + +$0 + +rm -rf "\${$1\}" diff --git a/emacs/.emacs.d/snippets/sh-mode/v b/emacs/.emacs.d/snippets/sh-mode/v new file mode 100644 index 0000000..daf8b33 --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/v @@ -0,0 +1,3 @@ +#name : v +# -- +"\${$1}"$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/sh-mode/va b/emacs/.emacs.d/snippets/sh-mode/va new file mode 100644 index 0000000..6fe9d6e --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/va @@ -0,0 +1,4 @@ +#name : va +# -- +local ${1:dir}= +$1=$($0) diff --git a/emacs/.emacs.d/snippets/sh-mode/vd b/emacs/.emacs.d/snippets/sh-mode/vd new file mode 100644 index 0000000..4e04405 --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/vd @@ -0,0 +1,3 @@ +#name : vad +# -- +local ${1:dir}=$0 diff --git a/emacs/.emacs.d/snippets/sh-mode/wh b/emacs/.emacs.d/snippets/sh-mode/wh new file mode 100644 index 0000000..8316bed --- /dev/null +++ b/emacs/.emacs.d/snippets/sh-mode/wh @@ -0,0 +1,6 @@ +#name : wh +# -- +while read -r ${1:f}; do + echo "\${$1}" + $0 +done diff --git a/emacs/.emacs.d/snippets/web-mode/a b/emacs/.emacs.d/snippets/web-mode/a new file mode 100644 index 0000000..8a435da --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/a @@ -0,0 +1,5 @@ +#name : a +# -- + + $0 + diff --git a/emacs/.emacs.d/snippets/web-mode/div b/emacs/.emacs.d/snippets/web-mode/div new file mode 100644 index 0000000..b130d10 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/div @@ -0,0 +1,5 @@ +#name : div +# -- +
+ $0 +
diff --git a/emacs/.emacs.d/snippets/web-mode/divv b/emacs/.emacs.d/snippets/web-mode/divv new file mode 100644 index 0000000..879bac1 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/divv @@ -0,0 +1,5 @@ +#name : divv +# -- +
+ $0 +
diff --git a/emacs/.emacs.d/snippets/web-mode/for b/emacs/.emacs.d/snippets/web-mode/for new file mode 100644 index 0000000..fbd7992 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/for @@ -0,0 +1,5 @@ +#name : for +# -- +{% for $1 in $2 %} + $0 +{% endfor %} diff --git a/emacs/.emacs.d/snippets/web-mode/h1 b/emacs/.emacs.d/snippets/web-mode/h1 new file mode 100644 index 0000000..0dfa679 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/h1 @@ -0,0 +1,4 @@ +#name : h1 +# -- +

$1

+$0 diff --git a/emacs/.emacs.d/snippets/web-mode/h2 b/emacs/.emacs.d/snippets/web-mode/h2 new file mode 100644 index 0000000..67fa966 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/h2 @@ -0,0 +1,4 @@ +#name : h2 +# -- +

$1

+$0 diff --git a/emacs/.emacs.d/snippets/web-mode/h3 b/emacs/.emacs.d/snippets/web-mode/h3 new file mode 100644 index 0000000..33451c6 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/h3 @@ -0,0 +1,4 @@ +#name : h3 +# -- +

$1

+$0 diff --git a/emacs/.emacs.d/snippets/web-mode/h4 b/emacs/.emacs.d/snippets/web-mode/h4 new file mode 100644 index 0000000..6ca3684 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/h4 @@ -0,0 +1,4 @@ +#name : h4 +# -- +

$1

+$0 diff --git a/emacs/.emacs.d/snippets/web-mode/if b/emacs/.emacs.d/snippets/web-mode/if new file mode 100644 index 0000000..faa0c5f --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/if @@ -0,0 +1,5 @@ +#name : if +# -- +{% if $1 %} + $0 +{% endif %} diff --git a/emacs/.emacs.d/snippets/web-mode/img b/emacs/.emacs.d/snippets/web-mode/img new file mode 100644 index 0000000..ed0df3f --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/img @@ -0,0 +1,3 @@ +#name : img +# -- +$2 diff --git a/emacs/.emacs.d/snippets/web-mode/incl b/emacs/.emacs.d/snippets/web-mode/incl new file mode 100644 index 0000000..62a9814 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/incl @@ -0,0 +1,3 @@ +#name : incl +# -- +{% include "$1" %} diff --git a/emacs/.emacs.d/snippets/web-mode/itemthumb b/emacs/.emacs.d/snippets/web-mode/itemthumb new file mode 100644 index 0000000..3eebdf3 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/itemthumb @@ -0,0 +1,13 @@ +#name : itemthumb +# -- + + {% if data.byhref[item.href].links.thumbnail[0] %} + thumbnail for {{ item.title }} +
+ {% endif %} + {{ item.title }} +
+$0 \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/web-mode/linkcss b/emacs/.emacs.d/snippets/web-mode/linkcss new file mode 100644 index 0000000..7c2dda9 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/linkcss @@ -0,0 +1,4 @@ +#name : linkcss +# -- + +$0 diff --git a/emacs/.emacs.d/snippets/web-mode/p b/emacs/.emacs.d/snippets/web-mode/p new file mode 100644 index 0000000..bacadc5 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/p @@ -0,0 +1,5 @@ +#name : p +# -- +

+ $0 +

diff --git a/emacs/.emacs.d/snippets/web-mode/style b/emacs/.emacs.d/snippets/web-mode/style new file mode 100644 index 0000000..1068b67 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/style @@ -0,0 +1,5 @@ +#name : style +# -- + diff --git a/emacs/.emacs.d/snippets/web-mode/with b/emacs/.emacs.d/snippets/web-mode/with new file mode 100644 index 0000000..0823e18 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/with @@ -0,0 +1,5 @@ +#name : with +# -- +{% with $1 = $2 %} + $0 +{% endwith %} diff --git a/emacs/.emacs.d/snippets/web-mode/{{ b/emacs/.emacs.d/snippets/web-mode/{{ new file mode 100644 index 0000000..48f4261 --- /dev/null +++ b/emacs/.emacs.d/snippets/web-mode/{{ @@ -0,0 +1,3 @@ +#name : = +# -- +{{ $0 }} diff --git a/emacs/.emacs.d/snippets/yaml-mode/k8-kustom b/emacs/.emacs.d/snippets/yaml-mode/k8-kustom new file mode 100644 index 0000000..ff3d7b5 --- /dev/null +++ b/emacs/.emacs.d/snippets/yaml-mode/k8-kustom @@ -0,0 +1,5 @@ +#key : k8s/kustomization +# -- +resources: + - ${1:deployment}.yaml + - ${2:service}.yaml diff --git a/emacs/.emacs.d/snippets/yaml-mode/k8deployment b/emacs/.emacs.d/snippets/yaml-mode/k8deployment new file mode 100644 index 0000000..8c9378e --- /dev/null +++ b/emacs/.emacs.d/snippets/yaml-mode/k8deployment @@ -0,0 +1,44 @@ +#key : k8s/deployment +# -- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ${1:foo}-deploy +spec: + replicas: ${2:1} + selector: + matchLabels: + app: $1 + template: + metadata: + labels: + app: $1 + ${3:webkind}: ${4:colour} + spec: + containers: + - name: $1 + image: docker.io/nginx:latest + volumeMounts: + - name: nginx-template-volume + mountPath: /etc/nginx/templates + - name: nginx-confd-volume + mountPath: /etc/nginx/conf.d + + ports: + - containerPort: 80 + env: + - name: NGINX_ENVSUBST_OUTPUT_DIR + value: /usr/share/nginx/html + + - name: COLOUR + valueFrom: + configMapKeyRef: + name: nginx-colour-config + key: $1.colour + volumes: + - name: nginx-template-volume + configMap: + name: nginx-template-config + - name: nginx-confd-volume + configMap: + name: nginx-conf.d-config diff --git a/emacs/.emacs.d/snippets/yaml-mode/k8ingress b/emacs/.emacs.d/snippets/yaml-mode/k8ingress new file mode 100644 index 0000000..0cb6bc7 --- /dev/null +++ b/emacs/.emacs.d/snippets/yaml-mode/k8ingress @@ -0,0 +1,18 @@ +#key : k8s/ingress +# -- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: ${1:foo}-ingress +spec: + rules: + - host: $1.`system-name` + http: + paths: + - pathType: Prefix + path: / + backend: + service: + port: + number: 80 + name: colour-service diff --git a/emacs/.emacs.d/snippets/yaml-mode/k8service b/emacs/.emacs.d/snippets/yaml-mode/k8service new file mode 100644 index 0000000..f5b7db3 --- /dev/null +++ b/emacs/.emacs.d/snippets/yaml-mode/k8service @@ -0,0 +1,14 @@ +#key : k8s/service +# -- +apiVersion: v1 +kind: Service +metadata: + name: ${1:foo}-service +spec: + type: ${2:NodePort} + ports: + - port: ${3:80} + targetPort: ${4:80} + + selector: + ${5:webkind}: ${6:colour}