Skip to content

Instantly share code, notes, and snippets.

@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
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 / .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 )\""
@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 / 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 %>