Skip to content

Instantly share code, notes, and snippets.

@JJSmithNet
JJSmithNet / Chef_ERB_Tags_Include_Example.ERB
Last active December 15, 2016 17:43
Chef ERB Tags Include Example
<% if node[:tags].include? 'thy_tag' %>
### Stuff to Include in Template
<% end %>
@JJSmithNet
JJSmithNet / .gitbashpromptrc
Last active June 7, 2017 19:02
Modify Default GIT BASH Prompt to Include Time
#!/bin/bash
export PS1="${PS1//\\n$/\\n\[\\D\{%Y%m%d-%H%M\}]'\[\033[36m\]'\$'\[\033[0m\]'}"
export PS1="${PS1//\\n$/$'\[\033[34m\]' \`cygpath -w \$\{PWD\}\`\\n\[\\D\{%Y%m%d-%H%M\}]'\[\033[36m\]'\$'\[\033[0m\]'}"
@JJSmithNet
JJSmithNet / .bash_profile_GIT_EDITOR
Created December 21, 2016 19:18
POSIX-To-Windows Path Conversion in GIT BASH
### POSIX-To-Windows Path Conversion (Watch Out!)
export GIT_EDITOR="\"$( cygpath --absolute --long-name --windows /usr/bin/vim )\""
ForegroundColour=131,148,150
BackgroundColour=0,43,54
CursorColour=255,255,0
Black=7,54,66
BoldBlack=0,43,54
Red=220,50,47
BoldRed=203,75,22
Green=133,153,0
BoldGreen=88,110,117
Yellow=181,137,0
@JJSmithNet
JJSmithNet / OneLiner.PS1
Last active October 14, 2019 15:13
PowerShell OneLiners
### Get GMSAs
Get-ADServiceAccount -Filter '*' | Sort-Object -Property name | ft -Property name -HideTableHeaders
### Service Selected Details
Get-WmiObject -ComputerName SomeComputer -Class Win32_Service | Where-Object -Property StartName -match "Service|OtherService" | Format-Table -Property Name, StartName
### Service Executable
gwmi win32_service | Where-Object { $_.name -cmatch "SOMETHING" } | Format-Table -Property Name,PathName -Wrap
### Finding Services
@JJSmithNet
JJSmithNet / X_Config_Kensington_Expert_Mouse_PRO.MD
Last active March 29, 2017 01:22
Map top-right main button to be middle-click on Kensington Expert Mouse PRO

Kensington Expert Mouse PRO

  • Map top-right main button to be middle-click

xinput set-button-map "Kensington USB/PS2 Wheel Mouse " 1 2 3 4 5 6 7 8 2

@JJSmithNet
JJSmithNet / GIT_Tips.MD
Last active April 7, 2017 18:19
GIT Tips
@JJSmithNet
JJSmithNet / SensuEventsUsingJQ.MD
Last active July 17, 2017 16:02
Sensu Events Using JQ

Specific Check

curl -s http://0.0.0.0:4567/events | jq '.[] | select (.check.name == "your_check_name") | [.client.name,.check.name,.check.output]'

Specific Check & HostName

curl -s http://0.0.0.0:4567/events | jq '.[] | select ( (.client.name | contains("PartialHostName") ) and ( .check.name | contains("PartialCheckName") ) ) | [.check.name,.client.name,.check.output]'

Specific Check & HostName, JSON Output

curl -s -X GET 127.0.0.1:4567/events | jq '.[] | select ( ( .client.name | contains ("PartialHostName" ) ) and .check.name == "exact_check_name" ) | { Name:.check.name, Out:.check.output,Client:.client.name } '