Skip to content

Instantly share code, notes, and snippets.

Avatar

Josiah Ritchie flickerfly

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am flickerfly on github.
  • I am josiah (https://keybase.io/josiah) on keybase.
  • I have a public key whose fingerprint is 7CB4 B7B7 E9FD 0CC9 F1C7 80EF B368 C6FB 4C9E F4AA

To claim this, I am signing this object:

@flickerfly
flickerfly / Get-ServiceByAccount.ps1
Last active Dec 14, 2015
Find a windows service by the account it runs as
View Get-ServiceByAccount.ps1
$accounts = @("name1","name2")
ForEach ($account in $accounts)
{
Get-WmiObject Win32_Service | where {$_.StartName -like "*$account*"}
} #end foreach
@flickerfly
flickerfly / IterateComputers.ps1
Created Mar 11, 2013
Iterate over all domain member servers that aren't domain controllers
View IterateComputers.ps1
#Select Servers that are not Domain Controllers
$computers = Get-ADComputer -Filter { operatingsystem -like "*server*" -and Enabled -eq "True" }
Foreach($computer in $computers)
{
} #end foreach
@flickerfly
flickerfly / Get-CurrentDomainName
Last active Dec 15, 2015
Get the name of the domain I'm on
View Get-CurrentDomainName
#Put the domain of the computer this script is running on into the $domain variable
$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name
@flickerfly
flickerfly / Get-DomainControllers.ps1
Last active Dec 15, 2015
Find all the Domain Controllers
View Get-DomainControllers.ps1
$DomainControllers = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers
@flickerfly
flickerfly / cleanCentOStemplate.sh
Created Sep 12, 2013
This is intended to clean up a CentOS or RedHat 6 box for conversion to a template in VMWare or other environments. It should be the last thing run before shutting down.
View cleanCentOStemplate.sh
#!/bin/bash
# This is intended to clean up a CentOS or RedHat 6 box for
# conversion to a template in VMWare or other environments
# Free to use as a reference document, check before you use this
# as I can't take responsibility if it breaks something
# You may want to simply delete the config files,
# I prefer to just remove the MAC record
@flickerfly
flickerfly / user_mem_usage.sh
Created Sep 12, 2013
Get memory usage of a user
View user_mem_usage.sh
$user = apache
ps u -u $user | awk '{total+=$3}END{print total}'
@flickerfly
flickerfly / todays_yum_changes.sh
Created Sep 12, 2013
Record the yum changes from today in a file that can be used to cut and paste appended to the command 'sudo yum install'
View todays_yum_changes.sh
sudo grep "`date "+%b %d"`" /var/log/yum.log | awk '{print $5}' | tr "\n$" ' ' > `date "+%d%b"`.yum
@flickerfly
flickerfly / amIroot.sh
Created Sep 12, 2013
A little check if a script is being run as root and exit if not with an error.
View amIroot.sh
# Must be run with root permissions
# sudo will be sufficient
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@flickerfly
flickerfly / crashplan
Created Oct 28, 2013
CrashPlan ufw firewall profile
View crashplan
[CrashPlan]
title=CrashPlan
description=CrashPlan is a simple and yet powerful backup solution that does not require a central server for management.
ports=4242/tcp