Created
September 28, 2022 01:53
-
-
Save ishu3101/e9583669297c7ea993cb780160be23c6 to your computer and use it in GitHub Desktop.
Config file for Espanso - Cross Platform Text Expander
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# espanso match file | |
# For a complete introduction, visit the official docs at: https://espanso.org/docs/ | |
# You can use this file to define the base matches (aka snippets) | |
# that will be available in every application when using espanso. | |
# Matches are substitution rules: when you type the "trigger" string | |
# it gets replaced by the "replace" string. | |
matches: | |
# Simple text replacement | |
- trigger: ":espanso" | |
replace: "Hi there!" | |
# NOTE: espanso uses YAML to define matches, so pay attention to the indentation! | |
# But matches can also be dynamic: | |
# Print the current date | |
- trigger: ":date" | |
replace: "{{mydate}}" | |
vars: | |
- name: mydate | |
type: date | |
params: | |
format: "%d/%m/%Y" | |
# Print the output of a shell command | |
- trigger: ":shell" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "echo 'Hello from your shell'" | |
# get IP Address on Linux | |
- trigger: ":getip" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "curl ifconfig.me" | |
# get IP Address on Windows | |
- trigger: ":winip" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "curl ifconfig.me" | |
shell: cmd | |
- trigger: ":ip4" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "curl https://api.ipify.org" | |
shell: cmd | |
- trigger: ":ip6" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "curl https://api64.ipify.org" | |
shell: cmd | |
- trigger: ":dadjoke" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "curl -H 'Accept: text/plain' https://icanhazdadjoke.com/" | |
shell: cmd | |
# Get a Random Quote | |
- trigger: ":randomquote" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "$url = 'https://ishu3101.github.io/jekyll-quotes/quotes.json'; (Invoke-WebRequest $url | ConvertFrom-Json | Get-Random).Quote" | |
# Get a Computer Model | |
- trigger: ":csmodel" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "Get-ComputerInfo | Select -ExpandProperty CsModel" | |
# Get a Computer Manufacturer | |
- trigger: ":csmanufacturer" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "(Get-WMIObject Win32_ComputerSystem).Manufacturer" | |
# Get CPU Information | |
- trigger: ":cpuinfo" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "(Get-WmiObject Win32_Processor).Name" | |
# Get Computer Host Name | |
- trigger: ":hostname" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "hostname" | |
# Get OS Name | |
- trigger: ":os" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "(Get-ComputerInfo).WindowsProductName" | |
# Get OS Architecture | |
- trigger: ":architecture" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: "(Get-WMIObject win32_operatingsystem).OSArchitecture" | |
# Get All the System Information | |
- trigger: ":sysinfo" | |
replace: "CPU: {{cpu}} \nOS: {{operatingsystem}} {{architecture}} \nManufacturer: {{manufacturer}} \nModel: {{model}}" | |
vars: | |
- name: cpu | |
type: match | |
params: | |
trigger: ":cpuinfo" | |
- name: operatingsystem | |
type: match | |
params: | |
trigger: ":os" | |
- name: architecture | |
type: match | |
params: | |
trigger: ":architecture" | |
- name: manufacturer | |
type: match | |
params: | |
trigger: ":csmanufacturer" | |
- name: model | |
type: match | |
params: | |
trigger: ":csmodel" | |
# List Wifi Network Passwords | |
- trigger: ":wifipasswords" | |
replace: "{{output}}" | |
vars: | |
- name: output | |
type: shell | |
params: | |
cmd: '(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)} | Select-String "Key Content\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Format-Table -Wrap' | |
# And much more! For more information, visit the docs: https://espanso.org/docs/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment