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 / node-sett.sh
Created April 13, 2019 15:08
Node sample regexp
#!/bin/bash
# Samples for Node set 1..
# ^(app\.js)|^(app\.[a-zA-Z0-9]+\.js)
ls | grep -E "app.[a-zA-Z0-9]+|app[0-9]{1,3}.js"
# ^(node_)[a-z0-9]+(.tmp)
ls | grep -E "node_[a-zA-Z0-9]+.tmp"
# %APPDATA%\npm-cache\_logs
@chrdek
chrdek / ps-sample.ps1
Last active March 7, 2019 21:31
Print terminal info, previous command runs in terminal cons.
rm "$HOME\Documents\outps.txt"
echo "Home Dir is ---> $HOME" >> "$HOME\Documents\outps.txt"
echo "Default Path is --> $PWD" >> "$HOME\Documents\outps.txt"
echo "Version is --> $BASH_VERSION (not running in ps)" >> "$HOME\Documents\outps.txt"
echo "Term type is --> $TERM (not running in ps)" >> "$HOME\Documents\outps.txt"
cat "$HOME\Documents\outps.txt"
powershell.exe cat "$HOME\Documents\outps.txt"
###########################################################################################
function ret1st() {
return "Last command was: "+$$;
@chrdek
chrdek / samplenums6.js
Created February 22, 2019 12:29
Sample numbers in string v6
f=v=>(d=v.map(c=>eval([...c].map(p=>p|0).join`+`)),d[0]==d[1])
@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.