Skip to content

Instantly share code, notes, and snippets.

View chrdek's full-sized avatar
♻️
Fully reCaptcha resistant....

ChrDek chrdek

♻️
Fully reCaptcha resistant....
  • Ham
  • Bacon
View GitHub Profile
@chrdek
chrdek / AESGCM_on_PlainText.cs
Created June 17, 2024 10:52
[Csharp] AES Galois Counter Mode Compliant Cipher Text Wrapper Example (plaintext or generated key)
public class AESGCMBytes { //AES-GCM Core wrapper class starts here.
//auto-properties for internal values store
public byte[] tempKey {get; set;}
public byte[] tempTag {get; set;}
public byte[] cipherText {get; set;}
public byte[] tempNonce{get; set;}
public string Encrypt(string plainTextinput) {
@chrdek
chrdek / RetrieveNuget.ps1
Created November 6, 2023 11:40
Retrieve nuget.org v2 API xml package data feeds by nuget package owner name (includes timing of response, preset url status change)
$roundtrip = (Measure-Command -Expression {
$mainXml = Invoke-WebRequest -Uri "https://www.nuget.org/api/v2/Search()?$filter=IsLatestVersion&searchTerm=%27owner%3Aownernamereplacehere%27&targetFramework=%27%27&includePrerelease=false&$skip=0&$top=5&semVerLevel=2.0.0" -UseBasicParsing -Method Get})
[string]$respTime = "$($roundtrip.TotalSeconds) secs";
$mainXml.Content
# NOTE: DateTime req. convert from ISO 8601 format by Newtonsoft JSONConvert.DeserializeObject
[PSCustomObject[]]$xmlMap = @();
[xml]$XmlInfo = (Get-Content "$($pwd.Path)/xmlfeed_pack.xml");
$XmlInfo.feed.entry | %{
@chrdek
chrdek / UsersEmailGen3.sh
Last active February 11, 2023 15:41
Methods of generating random data for mysql imports
#!/bin/bash
echo "UserName,Email,FirstName,LastName,Password" > users.csv;
for i in $(seq 1 100);
do
userid=$(uuidgen | sed 's/-//g');
uniqueid=$(echo $userid | head -c 10);
echo "$uniqueid,[email protected],FirstName,LastName,$( head -100 /dev/urandom | tr -dc a-zA-Z0-9 | fold -w ${1:-15} | head -1 )" >> users.csv
done
@chrdek
chrdek / browsercdn.js
Created February 11, 2023 11:53
Ways to test remote script libraries in-browser
//Run in F12 Tools console.
javascript:(function() { var s = document.createElement("script"); s.src="<yourCdnScriptUrl>.js";document.getElementsByTagName("head")[0].appendChild(s)})()
//Run in Browser bar, F12 Tools console (JQ, AngularJS testing).
javascript:(function(e,s){e.src=s;e.onload=function(){jQuery.noConflict();console.log('jQuery injected')};document.head.appendChild(e);})(document.createElement('script'),'https://code.jquery.com/jquery-latest.min.js')
javascript:(function(e,s){e.src=s;e.onload=function(){angular.injector(['ng']);console.log('AngularJS injected')};document.head.appendChild(e);})(document.createElement('script'),'https://ajax.googleapis.com/ajax/libs/angularjs/1.6.3/angular.min.js')
//Facebook external script inject - using <head> tag.
(function(d, script) {
script = d.createElement('script');
@chrdek
chrdek / track_dev.js
Last active November 22, 2022 21:07
Track/ Enumerate tabs in web browser session
console.clear();document.removeEventListener('visibilitychange',function(){});
document.addEventListener( 'visibilitychange' , function() {
if (document.URL.includes(document.URL.substr("https://stackoverflow.com"))) {
console.log('%cDeveloping . . . 👨‍💻', 'color:#bdecb6; background:#333c43; border-radius:15px; border:5px; border-color:lightgreen; text-shadow:2px; padding:10px');
}
if(document.URL != "" && document.URL.substr("https://stackoverflow") != "https://stackoverflow.com") {
console.log('%cJust Browsing . . 🌐', 'color:#58777d; font-size:0.98rem; font-weight:bold; font-family:Arial; background:#acbdd3; border-radius:50%;box-shadow: 10px 5px 5px #333c43; text-shadow:10px; padding:65px');
}
}, false );
@chrdek
chrdek / jquery_ext.js
Created November 5, 2022 19:29
Several jquery methods, jquery relevant functionalities for general web development
var filterTable = (function () { //start IIFE ..
return { //filtering parts..
addFilterTextBoxes: function() {
/* IIFE to activate filtering on keypress textboxes on jQuery DataTables columns */
var api = this.api();
// For each column
api
@chrdek
chrdek / rgb2hex.js
Created February 8, 2022 20:29
RGB Color to Hexadecimal counterpart in js
rgb2hex = s => s.match(/[0-9]+/g).reduce((x,y) => x + (y|256).toString(16).slice(1),'0x');
@chrdek
chrdek / timer_display.ps1
Created November 13, 2021 11:52
Make a real-time progress bar using powershell. example for 2000 ms
$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()
@chrdek
chrdek / PS_login_with_Screenshot.ps1
Last active July 31, 2023 19:45
Automated testing for login screen - login to website/take screenshot with watermark
<#
#
# 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
#
@chrdek
chrdek / Chrome_Downgrade.ps1
Last active March 15, 2021 12:18
Script for uninstall, downgrade chrome to earlier versions, locks future updates.
<#
# 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.