Skip to content

Instantly share code, notes, and snippets.

View crossan007's full-sized avatar

Charles Crossan crossan007

View GitHub Profile
@crossan007
crossan007 / README
Created April 9, 2021 01:18 — forked from xbb/README
IDRAC6 Virtual Console Launcher
Use this as an example on how to start the virtual console without the need of Java Web Start or accessing it from the web interface.
You can use the user and password that you use for the web interface.
You need an old JRE... I used 1.7.0_80 from the Server JRE package, also I have tested successfully 1.7.0_79 with MacOS.
You don't need to install it, just extract it or copy the files in "jre" folder.
Open the viewer.jnlp file that you get by launching the virtual console from the web interface with a text editor.
Note the urls to the jar files. Download the main jar file avctKVM.jar and the libs for your operating system and architecture.
Extract the dlls (.so Linux, .jnilib MacOS) from the jar libs.
$CSVFileName = "transaction_activity.csv"
$EZPT = Import-CSV $CSVFileName
$OFXString = 'OFXHEADER:100'+ "`n" +
'DATA:OFXSGML'+ "`n" +
'VERSION:102'+ "`n" +
'SECURITY:NONE'+ "`n" +
'ENCODING:USASCII'+ "`n" +
'CHARSET:1252'+ "`n" +
@crossan007
crossan007 / LinesToTable.ps1
Created January 27, 2020 16:26
Given a text file containing lines representing "cells" of a data grid, this script converts the lines into a set of objects (where the number of intended columns is set yb $offset)
$lines = Get-content ./t.txt #text file containing "single grid cells" as lines
$offset = 11 # desired number of columns in grid
$Header = @()
$tempObject = New-Object -TypeName PSObject
$objects = @()
For($i=0;$i -lt $lines.length;$i+=1) {
Write-host "Processing line $i of $($lines.length) in chunks of $offset"
if ($i -eq $offset) {
Write-host "Found Header $($header -join ',')"
}
@crossan007
crossan007 / Compare-XmlDocs.ps1
Created December 30, 2019 15:10 — forked from ctigeek/Compare-XmlDocs.ps1
Powershell - Compare two XML documents.
function Compare-XmlDocs($actual, $expected) {
if ($actual.Name -ne $expected.Name) {
throw "Actual name not same as expected: actual=" + $actual.Name
}
##attributes...
if ($actual.Attributes.Count -ne $expected.Attributes.Count) {
throw "attribute mismatch for actual=" + $actual.Name
}
for ($i=0;$i -lt $expected.Attributes.Count; $i =$i+1) {
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
driver.get('http://www.webdriverjs.com/');
driver.findElement(By.css('.search-field.form-control')).sendKeys("WebdriverJs");
driver.findElement(By.css('button.search-submit i')).click();
driver.wait(until.elementTextIs(driver.findElement(By.css('.vl-main-header>h1')), "Search Results for: WebdriverJs"), 10000);
@crossan007
crossan007 / Prune-FileBeatRegistryFiles.ps1
Created August 14, 2019 20:43
"Prune" specific entries from a Filebeat 6.x registry JSON file
$ErrorActionPreference = "Stop"
Function Test-IISLogFile{
Param(
$FilePath
)
return $($FilePath -Like "*.com\Logs\*") -or $($FilePath -Like "*.com\Log\*")
}
Function Clean-FileBeatRegistry {
Param(
$RegistryFile
'On Error Resume Next
do
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.SetOption 2, objHTTP.GetOption(2) - SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
objHTTP.Open "POST", "https://webserviceurl/shouldlock", False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.send ""
@crossan007
crossan007 / Get-LastLogLines.ps1
Created May 15, 2019 17:55
Gets the final lines of a really big log file, and outputs them to a smaller, more manageable log file
Function Get-LastLogLines {
Param(
$FileName,
$Lines = 30
)
# Method borrowed and adapted from: https://stackoverflow.com/questions/36507343/get-last-n-lines-or-bytes-of-a-huge-file-in-windows-like-unixs-tail-avoid-ti
$result = ""
$seq = "`r`n"
$buffer_size = 10mb
$buffer = new-object Byte[] $buffer_size
@crossan007
crossan007 / README.md
Created March 5, 2019 20:10 — forked from metmajer/README.md
Ansible Logging To Elasticsearch

Ansible Logging To Elasticsearch

Turns Ansible log outputs into plain JSON strings and sends them to an Elasticsearch cluster.

Place the script in your playbook's plugins/callbacks/ directory.

/* Add Recurring event, with a secondary calendar on the Third Tuesday of the Month */
DELIMITER $$
DROP PROCEDURE IF EXISTS create_events$$
CREATE PROCEDURE create_events()
BEGIN
DECLARE event_date DATETIME;
DECLARE event_end DATETIME;
DECLARE ocurrences INT;
DECLARE last_inserted INT;
DECLARE week_of_month DOUBLE;