This file contains hidden or 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
| $elapsedTime = [system.diagnostics.stopwatch]::StartNew() | |
| # change value for other timer durations. | |
| 1..2000 | %{write-progress -activity "Working..." -status "$([string]::Format("Time Elapsed: {0:d2}:{1:d2}:{2:d2}", $elapsedTime.Elapsed.hours, $elapsedTime.Elapsed.minutes, $elapsedTime.Elapsed.seconds))" -percentcomplete ($_/10);} | |
| $elapsedTime.stop() |
This file contains hidden or 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
| <# | |
| # | |
| # Initial login flow for website image to be generated | |
| # ->Open main website | |
| # -> Open login form | |
| # -> login to website main part, click on a 'specific' button | |
| # -> take screenshot of whole website part, logout and close browser window. | |
| # | |
| # NOTE: screenshot is watermarked with a timestamp (time/date) and an MD5 digest | |
| # |
This file contains hidden or 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
| <# | |
| # chrome_downgrade.ps1 | |
| # | |
| # Script used for downgrading current chrome installation to earlier instances (recommended up to v83+). | |
| # | |
| # Used for renaming current system configuration and sets | |
| # appropriate setting for using chrome with older version. | |
| # | |
| # WARNING: This script also will disable any future updates on chrome | |
| # so that the downgraded version is locked to the latest installation. |
This file contains hidden or 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
| Import-Module "$($($env:PSModulePath -split ';')[2])\Selenium\3.0.1\Selenium.psd1" -Force | |
| $Browser = Start-SeChrome -Arguments @("Incognito","start-maximized"); | |
| Enter-SeUrl "http://intranet.test.site.net" -Driver $Browser | |
| # Main login form. | |
| $txtuname = Find-SeElement -Driver $Browser -By Name -Selection "username"; | |
| Send-SeKeys -Element $txtuname -Keys "usename1pass1"; | |
| $txtpassword = Find-SeElement -Driver $Browser -By Name -Selection "password"; | |
| Send-SeKeys -Element $txtpassword -Keys "onetimepass1pass2"; |
This file contains hidden or 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
| <# | |
| Create a new email -with attachment- in outlook and save draft. | |
| #> | |
| $OL = New-Object -ComObject Outlook.Application | |
| Start-Sleep 5 | |
| #Create Mailbox Item | |
| $mItem = $OL.CreateItem(0); | |
| #Add Messages etc.. |
This file contains hidden or 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
| :: Method 1 (Zip compression using 15 passes with deflate) | |
| "%PROGRAMFILES%\7-Zip\7z.exe" a -mm=Deflate -mfb=258 -mpass=15 -r "%USERPROFILE%\Downloads\samples1.zip" "%USERPROFILE%\Downloads\zipfiles\*" | |
| 1294MB -> 1192 MB (7.9% compression) | |
| :: Method 2 (Zip compression using max compression with deflate) | |
| "%PROGRAMFILES%\7-Zip\7z.exe" a "%USERPROFILE%\Downloads\samples1.zip" "%USERPROFILE%\Downloads\zipfiles\*" -tzip -mx9 -mm=Deflate64 | |
| 1294 MB -> 1189 MB (8.2% compression) |
This file contains hidden or 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
| <# | |
| .SYNOPSIS | |
| ** USE AT OWN RISK AND WITH CAUTION ** | |
| Function used for byte-level information scrambling for most files (For example: zip,documents,plain text or pdf). | |
| .DESCRIPTION | |
| ** USE AT OWN RISK AND WITH CAUTION ** | |
| This function provides various methods of destroying the contents of a file, rendering it unreadable. | |
| It can either be used on text or other types of data file formats. | |
| Methods of removing data include XOR directly bytes in file, removing data by using source-dest. files |
This file contains hidden or 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
| Function Modify-Excel([switch]$addSheet) { | |
| $defaultdir = "$env:USERPROFILE\Documents\Spreadsheet_1.xlsx"; | |
| $xls = New-Object -ComObject Excel.Application; $xls.Visible = $false; | |
| $xlShiftDown = -4121; | |
| $fileModify = $xls.Workbooks.Open($defaultdir); | |
| # select latest/current working month .. | |
| $spreadSheet = $fileModify.ActiveSheet; # $fileModify.Worksheets | ?{ $_.Name -ilike "*2020" } | Select -Last 1 |
This file contains hidden or 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
| //Extend the String object with toBase64() and fromBase64() functions | |
| //ES6.. | |
| String.prototype.toBase64 = function() { | |
| var basechars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; | |
| return [...this].map(c=>c.charCodeAt()).map(n=> { | |
| return ((+n).toString(2).length < 8) ? "0".repeat(8-(+n).toString(2).length)+(+n).toString(2) | |
| :(+n).toString(2); | |
| }).join("") | |
| .replace(/(\d)(?=(?:\d{6})+$)/g,"$1 ") | |
| .split(" ") |
This file contains hidden or 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 oneliner function converts 12-Hour time into its 24-Hour counterpart. | |
| // Examples (hh:mm:ss(PM/AM) to HH:MM:ss(24hour): | |
| // 12:00PM ->12:00, 12:00AM->00:00, 04:00PM -> 16:00 | |
| function timeConversion(s) { | |
| return (s.includes("PM")) ? | |
| (s.replace(s.split(':')[0],(s.startsWith("12"))?s.split(':')[0]:(Number(s.split(':')[0])+12)+"")).replace("PM","") : | |
| (s.replace(s.split(':')[0], | |
| (s.startsWith("12"))?(s.split(':')[-1])||"00":s.split(':')[0]) | |
| .replace(s.split(':')[0], |