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], |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!/bin/bash | |
GPIO_PIN=10 | |
# stop gpio pins, relevant cmd process | |
ctrl_c() { | |
echo "0" > "/sys/class/gpio/gpio${GPIO_PIN}/value" | |
echo $GPIO_PIN > /sys/class/gpio/unexport | |
exit | |
} |
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
<# Methods for generating secure passwords with various types of security #> | |
# Password length 10, alphanumeric with symbols | |
$var = @("a","f","G","A","4""\","$","0","1","9","4","2",":F","3","..>","5","m","'","<",".","k","8","7","i",";","K","l","=","+"); $output=""; | |
0..10 | %{ $output+=$var[$(Get-Random -Maximum 10)]; } | |
# Password length 10, SHA-256 derived OTP | |
(Get-Random) > "./tempcode.hash"; "$($((Get-FileHash -Path "./tempcode.hash").Hash)[0..10] + '')"-replace " ",([String]::Empty); | |