-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.yml
292 lines (253 loc) · 9.15 KB
/
utils.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
name: jimsespanso-utils
package_author: Jimmy Briggs <jimmy.briggs@jimbrig.com>
parent: default
matches:
# Public IPv4 IP Address
- trigger: ":ip"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "curl ifconfig.me"
shell: cmd
# Weather for Current Location
- trigger: ":weather"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: 'curl https://wttr.in?format="%l:+%c+%t\n"'
shell: cmd
# Auto-Closing Brackes, Quotes, Formatting Modifiers, and put Cursor in Center
- trigger: ':('
replace: '($|$)'
- trigger: ':['
replace: '[$|$]'
- trigger: ':{'
replace: '{$|$}'
- trigger: ':<'
replace: '<$|$>'
- trigger: ':`'
replace: '`$|$`'
- trigger: ':"'
replace: '"$|$"'
- trigger: ':_'
replace: '_$|$_'
- trigger: ':*'
replace: '*$|$*'
- trigger: ':-'
replace: '-$|$-'
# Markdown Code Blocks
# No Language
- trigger: :md-code
replace: "```\n$|$\n```"
# R
- trigger: :md-code-r
replace: "```r\n$|$\n```"
# Python
- trigger: :md-code-py
replace: "```python\n$|$\n```"
# Bash
- trigger: :md-code-py
replace: "```bash\n$|$\n```"
# Shell
- trigger: :md-code-py
replace: "```sh\n$|$\n```"
# PowerShell
- trigger: :md-code-py
replace: "```powershell\n$|$\n```"
# SQL
- trigger: :md-code-py
replace: "```sql\n$|$\n```"
# HTML
- trigger: :md-code-py
replace: "```html\n$|$\n```"
# JavaScript
- trigger: :md-code-py
replace: "```javascript\n$|$\n```"
# CSS
- trigger: :md-code-py
replace: "```css\n$|$\n```"
# Golang
- trigger: :md-code-py
replace: "```go\n$|$\n```"
# JSON
- trigger: :md-code-py
replace: "```json\n$|$\n```"
# YAML
- trigger: :md-code-py
replace: "```yaml\n$|$\n```"
# TOML
- trigger: :md-code-py
replace: "```toml\n$|$\n```"
# INI
- trigger: :md-code-py
replace: "```ini\n$|$\n```"
# Dockerfile
- trigger: :md-code-py
replace: "```dockerfile\n$|$\n```"
# Terraform
- trigger: :md-code-py
replace: "```python\n$|$\n```"
# HTTP
- trigger: :md-code-py
replace: "```http\n$|$\n```"
# Mermaid
- trigger: :md-code-py
replace: "```mermaid\n$|$\n```"
# Inserts markdown collapsable section
- trigger: :md-collapse
replace: "<details><summary>$|$</summary><p>\n\n</p></details>"
# Outputs markdown link, with clipboard contents as the URL
- trigger: ":md-link"
replace: "[{{Title}}]({{URL}})"
vars:
- name: "URL"
type: "clipboard"
- name: "Title"
type: shell
params:
cmd: "wget -qO- \"{{URL}}\" | gawk -v IGNORECASE=1 -v RS='</title' 'RT{gsub(/.*<title[^>]*>/,\"\");print;exit}'"
shell: wsl
# Creates a HTML anchor element, with clipboard contents as href
- trigger: ":html-link"
replace: "<a href=\"{{clipboard}}\" />$|$</a>"
vars:
- name: "clipboard"
type: "clipboard"
# Inserts common HTML elements
- trigger: :hr
replace: '<hr />'
- trigger: :br
replace: '<br />'
- trigger: :div
replace: '<div>$|$</div>'
- trigger: :span
replace: '<span>$|$</span>'
- trigger: :h1
replace: '<h1>$|$</h1>'
- trigger: :h2
replace: '<h2>$|$</h2>'
- trigger: :h3
replace: '<h3>$|$</h3>'
- trigger: :para
replace: '<p>$|$</p>'
# Inserts any custom HTML, XML or web component tag
- trigger: ":tag"
replace: "<{{html.element}}>$|$</{{html.element}}>"
vars:
- name: "html"
type: form
params:
layout: "XML / HTML Element Inserter\nTag Name: {{element}}"
fields: { element: { type: text }}
# Outputs todays date (yyyy-MM-DD)
- trigger: ":date"
replace: "{{date}}"
vars:
- name: date
type: date
params:
format: "%Y-%m-%d"
# Outputs the current time (24hr)
- trigger: :time
replace: "{{time}}"
vars:
- name: time
type: date
params:
format: "%H:%M"
# Outputs the month and year (e.g. January 2020)
- trigger: :month
replace: "{{date}}"
vars:
- name: date
type: date
params:
format: "%B %Y"
# Ouputs MIT License
- trigger: :mit-license
replace: "Copyright © Jimmy Briggs {{year}}: https://github.com/jimbrig\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nExcept as contained in this notice, the name of Jimmy Briggs shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Jimmy Briggs <jimmy.briggs@jimbrig.com>."
vars: [{name: year, type: date, params: {format: "%Y"}}]
# MIT License Markdown Format
- trigger: :md-mit-license
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: 'Invoke-WebRequest https://gist.githubusercontent.com/jimbrig/ad4ea326362446a445b32a551f5e4bb0/raw/a301907d7597e671ebec58e6e5964603a97571fd/LICENSE.md -Headers @{"accept"="text/plain"} | Select-Object -Expand Content'
shell: powershell
# Unlicense
# Outputs git commit command, with cursor in the message block
- trigger: :commit
replace: git commit -m "$|$"
# Quick search, formulates the URL params for searching a given website
- triggers: [:srch-ddg, :search-duckduckgo]
replace: 'https://duckduckgo.com/?q='
- triggers: [:srch-wiki, :search-wikipedia]
replace: 'https://en.wikipedia.org/w/?search='
- triggers: [:srch-gh, :search-github]
replace: 'https://github.com/search?q='
- triggers: [:srch-so, :search-stackoverflow]
replace: 'https://stackoverflow.com/search?q='
- triggers: [:srch-dh, :search-dockerhub]
replace: 'https://hub.docker.com/search?q='
- triggers: [:srch-wa, :search-wolframalpha]
replace: 'https://www.wolframalpha.com/input/?i='
- triggers: [:srch-red, :search-reddit]
replace: 'https://www.reddit.com/search/?q='
- triggers: [:srch-bbc, :search-bbc]
replace: 'https://www.bbc.co.uk/search?q='
- triggers: [:srch-vt, :search-virustotal]
replace: 'https://www.virustotal.com/gui/search/'
- triggers: [:srch-amz, :search-amazon]
replace: 'https://amazon.co.uk/s?k='
- triggers: [:srch-yt, :search-youtube]
replace: 'https://youtube.com/results?q='
- triggers: [:srch-maps, :search-maps]
replace: 'https://www.google.com/maps/search/'
- triggers: [:srch-goo, :search-google]
replace: 'https://google.com/search?q='
# Similar to above, but it uses the clipboard for the search query
- trigger: ":swc-ddg"
replace: "https://duckduckgo.com/?q={{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-wiki"
replace: "https://en.wikipedia.org/w/?search='{{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-gh"
replace: "https://github.com/search?q={{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-so"
replace: "https://stackoverflow.com/search?q={{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-dh"
replace: "https://hub.docker.com/search?q={{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-wa"
replace: "https://www.wolframalpha.com/input/?i={{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-red"
replace: "https://www.reddit.com/search/?q={{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-bbc"
replace: "https://www.bbc.co.uk/search?q={{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-vt"
replace: "https://www.virustotal.com/gui/search/{{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-amz"
replace: "https://amazon.co.uk/s?k={{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-yt"
replace: "https://youtube.com/results?q={{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-maps"
replace: "https://www.google.com/maps/search/{{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]
- trigger: ":swc-goo"
replace: "https://google.com/search?q={{clipboard}}"
vars: [{ name: "clipboard", type: "clipboard"}]