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 / samplenums3.js
Created February 22, 2019 12:22
Sample numbers in string v3
f=v=>{[...v].map(c=>eval([...c].map(p=>p|0).join`+`));return!(v[0]^v[1])
@chrdek
chrdek / package.json
Last active January 8, 2019 23:11
Generate random urls with predefined query information.
{
"name":"rand-url-create",
"version":"0.0.1",
"description":"Random URL Generator URI encoded param",
"license":"Creative Commons Zero v1.0 Universal",
"author":"C. Dek. chrdek - github"
}
@chrdek
chrdek / stringtoKvpEnc1.js
Created December 23, 2018 16:29
String of value pairs to object array, encoded.
//Extract key-values from string in the format of 'k1=v1&k2=v2&k3=v3' (with uri decoding)
String.prototype.ToKvps = function(){
var qd={};
this.split`&`.forEach(item => {let [k,v] = item.split`=`; v = v && decodeURIComponent(v);
(qd[k] = qd[k] || []).push(v)});
return qd;
}
//Example: JSON.stringify("fd=44&ds=32&dks=1314%41&sd=39%209&ds=dsl%20ds".ToKvps());
//Output: "{"fd":["44"],"ds":["32","dsl ds"],"dks":["1314A"],"sd":["39 9"]}"
@chrdek
chrdek / stringTokvp1.js
Last active June 6, 2019 19:43
Create array of objects with names, values
// Input string format: 'fd=44&ds=32&dks=1314' is converted to output array of objects..
String.prototype.ToKVPObj= function(){
return(this+"&").match(/[a-zA-Z]+(=){1}[a-zA-Z0-9]+(&){1}/gi)
.map(c=> {var a=[]; var dObj={};
a = c.replace("&","").split("=");
dObj[a[0]]=a[1];
return dObj;
});
}
@chrdek
chrdek / Filemon.ps1
Created December 20, 2018 14:17
Log file monitoring on local file system, export modifications in CSV format
<#
.Synopsis
Original file taken from https://gallery.technet.microsoft.com/scriptcenter/Powershell-FileSystemWatche-dfd7084b
Adapted for monitoring visual studio debug crashes with delimited log files creation/modification
.Description
This script monitors only log files created or modified on a specified directory
and creates the corresponding csv output per changed file content
NOTE: Default target dir is C:\%APPDATA%\
@chrdek
chrdek / Csv-Filer.ps1
Created December 20, 2018 14:13
Generating CSV output from *.log files and bulk uploading to loggly for log analytics via curl.
<#
.Synopsis
This function is used for generating csv output from a log file that contains
visual studio debug info, and cleans text content for uploading to a log analysis service
.Description
The script might need to be run on-demand or via a scheduled task per modified folder or changed file event
It exports debug info and creates the appropriate csv formatted output files
NOTE: Generated file with size larger than 64K is transferred to loggly service,
@chrdek
chrdek / stash-colorize.sh
Last active December 20, 2018 14:29
Script for displaying & color coding all git stashes by number of changes
#!/bin/bash
##################################################################################################
#
# Display stash details with colorized output.
#
# Author: Chr. Dek.
@chrdek
chrdek / stringReversalv1.js
Created December 2, 2018 23:06
Simple loop usage for string reversal (without using reverse())
//String reverse function with for loop
String.prototype.reverseString = function(){
s=[...this]; r=[];
for(i=0;;){if(i!=s.length){r.push(s.pop())}else{break;}}
return r.join('');
}
//Sample usage: "thisisreversed12".reverseString();
//Output from usage
//"21desreversisiht"
@chrdek
chrdek / arrayelremove.js
Last active December 2, 2018 17:10
remove specific element from array +shift
//Example 1 element remove..
Array.prototype.removeAt = function(i) {
delete this[i]; return this.filter(e=>e);
}
@chrdek
chrdek / arrayelzip.js
Created November 25, 2018 22:32
Transform onedim arrays into twodim..
var a = [0,1,2,3,4],
b = [5,6,7,8,9];
Array.prototype.zip = function (arr) {
return this.map(function (e, i) {
return [e, arr[i]];
})
};
//Usage: a.zip(b) = [[0,5], [1,6], [2,7], [3,8], [4,9]]