This file contains 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
# prints stdout and logs to file | |
function logger () | |
{ | |
echo "${1}" | tee -a $LOG_FILE | |
} | |
# function to wrap errors and exit | |
# USAGE: rc=${PIPESTATUS[0]} ; check_return_value | |
rc=0 | |
function check_return_value |
This file contains 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
$path = 'C:\omar\Web.config' | |
$xml = [xml](Get-Content $path) | |
$UseWebResourceCDN=$xml.configuration.appSettings.add | where {$_.key -eq 'UseWebResourceCDN'} | |
$UseWebResourceCDN.Value = 'True' | |
$xml.save($path) |
This file contains 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
# load xml | |
[xml]$xml = `what evber out put that prints xml - or can load xml from file path` | |
# read xml contents | |
$xml.nodeName.ChildNodes |
This file contains 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
sc.exe config $ServiceName start= "delayed-auto" |
This file contains 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
## incomplete; just a guide so I can remember | |
$log_file | |
last_length = `cat /tmp/${log_file}_last_length` | |
current_legnth = 'wc -c $log_file' | |
if [[ $last_file_length > 0 ]] ; then | |
diff_length = current_length - last_length | |
if [[ diff_length >= 0 ]] ; then |
This file contains 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
# This script will first install the "PSWindowsUpdate" PS Module and then install KBs we specify in this script | |
# KB_ID Description | |
# KB3042553 MS15-034 Critical: Vulnerability in HTTP.sys Could Allow Remote Code Execution - https://technet.microsoft.com/en-us/library/security/ms15-034.aspx | |
# TO DO make it more robust where we can pass kb articles by hash and loop check | |
$kb_to_patch="KB3042553" | |
$ps_windows_update_zip="C:\Windows\temp\PSWindowsUpdate.zip" | |
$ps_modules_dir="C:\Windows\System32\WindowsPowerShell\v1.0\Modules" |
This file contains 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
$EC2_launch_time = Get-Date (Get-EC2Instance -Instance $instanceId | % { $_.RunningInstance } | Select-Object -expand LaunchTime) -format "M/d/yyyy hh:mm:ss tt" | |
$Windows_bootTime = Get-Date (Get-CimInstance -ClassName win32_operatingsystem | select -expand lastbootuptime).tostring().trim() -format "M/d/yyyy hh:mm:ss tt" |
This file contains 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
gawk -vFPAT='[^,]*|"[^"]*"' '{print $1,$2,$3}' | |
This file contains 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
tar ... | ssh ... | |
pipe_exit_status="${PIPESTATUS[@]}" | |
tar_status=`echo $pipe_exit_status | awk '{print $1}'` | |
ssh_status=`echo $pipe_exit_status | awk '{print $2}'` |
This file contains 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
python: | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
urllib2.urlopen("https://dynamicdns.park-your-domain.com/update?host=%s&domain=%s&password=%s" % ("SUBDOMAIN", "DOMAIN", "namecheap.dynamicDNS.PASSWORD")) |