CSS For Fast Scroll – No Lags!

Pure CSS (no JavaScript!) tricks to allow you a faster, more reactive page.

Lags while scrolling native pages
are caused by an overly complex styles (usually “zero css” or “normalize css”)
overriding the proper definitions.

Continue reading

Solved: CMD – Comma And Apostrophe In File Name

working with com.whatsapp_2.17.35' 8-452027_minAPI15(armeabi,armeabi-v7a,mips,x86)(nodpi)_apkmirror.com.apk,
the %1, %~1 tries to parse a list of arguments
and will give you: com.whatsapp_2.17.35' 8-452027_minAPI15(armeabi.

%~s1 will fail too.

A workaround:
gulp the entire thing,
and re-parse content into short-path for easier usage.

@echo off
::                              enable Unicode support for path/file-name.
chcp 65001 2>nul >nul

::                              single arg - workaround weird file-name.
set "ARG=%*"
for /f %%a in ("%ARG%") do ( set 'ARG=%%~fsa' )

pure CMD:
the code above will generate a fully-qualified,
short (8.3-DOS like) path.

if you do need to pass more than one argument,
this is not the solution for you.

– – – – – –

The above code does not always works
since it will turn off any tries to parse single argument from the string,

Passing %* to other programs as an argument will always work,
but built-in handling of file-names, with apostrophes will still fail,
due to “by design” issues in CMD (wrapping phrases uses apostrophes..)

instead, try passing %* to GetShortPathName.exe from github.com/eladkarako/GetShortPathName,
with the additional processing allowing empty-strings/empty-character (\0) and Windows API.
it will return a short 8.3 version of the path (relative or full),
if you want a fully qualified path try using GetFullPathName.exe from github.com/eladkarako/GetFullPathName.

You can use your choice of implementations, that simple one is written in VB6.

How To Properly Extract MSU

MSU can be extracted (first layer) using 7zip.

for second layer you can’t directly extract the CAB files,
let pkgmgr do it for you,

point to the folder holding the xml (first layer folder),
and use ‘s:’ to specify temp folder.

C:\Users\Elad\Desktop\DBV-T2\Extracted>pkgmgr /n:C:\Users\Elad\Desktop\DBV-T2\Extracted\Windows6.1-KB3033929-x64.xml /s:C:\Users\Elad\Desktop\DBV-T2\

once it is extracted the package will get installed,
but if you’ll be fast you can grab the files/folders before they get deleted.

Better use this method in a VM.

JavaScript Snippet – A Human-Readable Memory-Formatter, Add Commas To A Number By Regular-Expression

function human_readable_bytes_size(bytes, decimals, sap) {
  decimals = "number" === typeof decimals ? decimals : 2;
  sap = "string" === typeof sap ? sap : "";

    size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
  , factor = Math.floor(  (String(bytes).length - 1) / 3  )
  bytes = bytes / Math.pow(1024, factor);  //calc
  bytes = Math.floor(bytes * Math.pow(10, decimals)) / Math.pow(10, decimals);  //round digits
  return String(bytes) + sap + size[factor];


also available on GitHub: https://github.com/eladkarako/javascript_human_readable_bytes_size

Would you like the PHP version? – http://icompile.eladkarako.com/php-snippet-a-human-readable-memory-formatter-add-commas-to-a-number-by-regular-expression/

This is a variation with comma-separation (only for the integer part since the fraction part looks weird w/ commas..)

function human_readable_bytes_size(bytes, digits, sap, is_comma_sap) {  "use strict";
  digits       = "number"  === typeof digits        ? digits         :  2;
  sap          = "string"  === typeof sap           ? sap            : "";
  is_comma_sap = "boolean" === typeof is_comma_sap  ? is_comma_sap   : false;

  var  size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
     , factor = Math.floor(  (String(bytes).length - 1) / 3  )

  bytes = bytes / Math.pow(1024, factor);  //calc
  bytes = Math.floor(bytes * Math.pow(10, digits)) / Math.pow(10, digits);  //round digits
  if(true === is_comma_sap){
    bytes = String(bytes).split(".");
    bytes[0] = bytes[0].replace(/(\d)(?=(\d{3})+$)/g, "$1,");
    bytes = bytes.join(".");

  return String(bytes) + sap + size[factor];

since it is very rare (actually improbable) to use the comma-feature when measuring to the largest scale available,
– In my project https://github.com/eladkarako/any2base64 I’m using a slightly different variation that actually ‘reduce a scale by one’ meaning, instead of using 1GB it will use 1024MB (or 1000-MiB..
* [1] [2])

It works nicely, and sometimes helps to comprehend byte sizes more clearly… Ahhh.. human perspective! ;] ;]


Here is another variation:
1. it breaks with an error, which is useful for simpler to use within try/catch
without need to pre-check the input is valid.
2. it allows a full/long description.

function human_readable_bytes_size(bytes, decimals, sap, is_desc_short) {
  bytes          = Number(bytes);                                              //normalize input.
  decimals       = "number"  === typeof decimals      ? decimals      : 2;     //
  sap            = "string"  === typeof sap           ? sap           : "";    //
  is_desc_short  = "boolean" === typeof is_desc_short ? is_desc_short : true;  //

  if(true === /NaN/i.test(String(bytes)))                         //handle invalid input.
    throw new Error("\"bytes\" Input-Argument Is NOT A Number.");

  var factor     = Math.floor(  (String(bytes).length - 1) / 3  )
     ,desc_short = ['B',     'kB',        'MB',        'GB',        'TB',        'PB',        'EB',       'ZB',         'YB']
     ,desc_long  = ['Bytes', 'KiloBytes', 'MegaBytes', 'GigaBytes', 'TeraBytes', 'PetaBytes', 'ExaBytes', 'ZettaBytes', 'YottaBytes']

  bytes = bytes / Math.pow(1024, factor);  //calc
  bytes = Math.floor(bytes * Math.pow(10, decimals)) / Math.pow(10, decimals);  //round digits

  return  String(bytes)
        + sap
        + (true === is_desc_short ? desc_short[factor] : desc_long[factor])

and using it with:

  human_readable_bytes_size(10000000000000,3," ",false)

//will give you "9.095 TeraBytes"


human_readable_bytes_size("a10000000000000",3," ",false)

//will give you something like...
//Uncaught Error: "bytes" Input-Argument Is NOT A Number.

Negative Regular-Expression

I’ve got a text-file, and I want to delete all
of the lines which do not contain the sub-string “switch“.

Some regex-engines will allow the search-replace ^.*((?!switch)).*$,
with empty string.
Most of “gnu-based” engines like grep and sed will support that.

For those who won’t,
you can mimic it with a positive, two-steps replacement,
it will require match-memory/backtrack/back-trace support
($1 or \1 is commonly used to remember the first match).
V8/JavaScript and Scintilla-based editor will support that.

I’m using my modded-version of Notepad2, which supports a such search-replace.

first replacement is to “mark a good line”:
replace ^(.*switch.*)$ with #\1 (adds a # characters at line-start).

second replacement will remove bad-lines with (simple) single-character-NOT rule:
replace ^[^#].*$ with an empty-string (removes lines that do not start with #).

(and you may probably want to restore the original-line by removing the # prefix using last search-replace: replace ^# to empty-string)

Continue reading

KBD (Keyboard Key) Style

Nothing fancy, background image that is stretched with some padding.
some CSS to avoid selecting/marking/drag&drop.

Continue reading

CSS For Speed

include those to override some of the browser’s default definitions,
it should be placed in the few first CSS file to load, but after the “reset CSS” (if you use any),
and before any of the websites’ main style.

Continue reading

CrossDomain.xml And ClientAccessPolicy.xml – Extremely Permissive


<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
  <site-control permitted-cross-domain-policies="all"/>
  <allow-access-from domain="*" to-ports="*" secure="false"/>
  <allow-http-request-headers-from domain="*" headers="*" secure="false"/>


<?xml version="1.0" encoding="utf-8"?>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
        <resource path="/" include-subpaths="true"/>

Some notes:
– Now days only Flash, Flex and Silverlight have any use for it.
encoding="utf-8", encoding="utf8", encoding="ISO-8859-1" or encoding="US-ASCII" doesn’t really matter. You should probabbly only use ASCII encoded files (4-bit).
– Serve your file with media-type (mimetype) HTTP header of Content-Type: text/x-cross-domain-policy,
(but text/plain, text/xml, application/xml or application/xhtml+xml would probably work too…)
– If you want to place those XML files anywhere- not only the root of the domain, but sub-domain or any path/sub-directory, you should make-sure your server sends X-Permitted-Cross-Domain-Policies HTTP header, with the value all, you only need to send it with the index and the xml files,
but you can send it with all of the resources using Header set X-Permitted-Cross-Domain-Policies "all" (APACHE/.htaccess) which may be more easy.

Alternative policy file-schemas
Generic DTD – http://www.adobe.com/xml/dtds/cross-domain-policy.dtd
Generic XSD – http://www.adobe.com/xml/schemas/PolicyFile.xsd
HTTP XSD – http://www.adobe.com/xml/schemas/PolicyFileHttp.xsd
HTTPS XSD – http://www.adobe.com/xml/schemas/PolicyFileHttps.xsd
FTP XSD – http://www.adobe.com/xml/schemas/PolicyFileFtp.xsd
Socket XSD – http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd

For best results you can add your server some permissive HTTP CORS headers for a more modern, HTML5 permissive resource access.


Here are extremely permissive set of CORS HTTP headers,
in a .htaccess/APACHE compatible format.

If you’re using an old GoDaddy.com hosting you’ll need that first:

Header unset   Access-Control-Allow-Methods
Header unset   Access-Control-Allow-Origin
Header unset   Access-Control-Allow-Headers
Header unset   Access-Control-Expose-Headers
Header unset   Access-Control-Allow-Credentials
Header unset   Timing-Allow-Origin
Header unset   X-Permitted-Cross-Domain-Policies

This is what you’re looking for:

Header   set   Access-Control-Allow-Methods        "CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,PING,POST,PUT,TRACE"
Header   set   Access-Control-Allow-Origin         "*"
Header   set   Access-Control-Allow-Headers        "Accept,Accept-Charset,Accept-Encoding,Accept-Language,Access-Control-Allow-Credentials,Access-Control-Allow-Headers,Access-Control-Allow-Methods,Access-Control-Allow-Origin,Access-Control-Expose-Headers,Access-Control-Max-Age,Access-Control-Request-Headers,Access-Control-Request-Method,Alt-Svc,Cache-Control,Connection,Content-Description,Content-Encoding,Content-Language,Content-Length,Content-Security-Policy,Content-Transfer-Encoding,Content-Type,Cookie,Date,DNT,Downlink,DPR,Expires,Host,If-Modified-Since,Keep-Alive,Last-Event-ID,Last-Modified,Origin,P3P,Pragma,Referer,Referrer-Policy,Remote-Address,Save-Data,Server,Set-Cookie,Strict-Transport-Security,Timing-Allow-Origin,Transfer-Encoding,Upgrade-Insecure-Requests,User-Agent,Vary,Viewport-Width,Width,X-Backend-Server,X-Cache-Info,X-Content-Type-Options,X-CustomHeader,X-Forwarded-For,X-Forwarded-Host,X-Forwarded-Port,X-Forwarded-Proto,X-Forwarded-Server,X-Frame-Options,X-HTTP-Method-Override,X-Kuma-Revision,X-Modified,X-OTHER,X-Permitted-Cross-Domain-Policies,X-PING,X-PINGOTHER,X-Powered-By,X-Real-IP,X-Requested-With,X-XSS-Protection"
Header   set   Access-Control-Expose-Headers       "Accept,Accept-Charset,Accept-Encoding,Accept-Language,Access-Control-Allow-Credentials,Access-Control-Allow-Headers,Access-Control-Allow-Methods,Access-Control-Allow-Origin,Access-Control-Expose-Headers,Access-Control-Max-Age,Access-Control-Request-Headers,Access-Control-Request-Method,Alt-Svc,Cache-Control,Connection,Content-Description,Content-Encoding,Content-Language,Content-Length,Content-Security-Policy,Content-Transfer-Encoding,Content-Type,Cookie,Date,DNT,Downlink,DPR,Expires,Host,If-Modified-Since,Keep-Alive,Last-Event-ID,Last-Modified,Origin,P3P,Pragma,Referer,Referrer-Policy,Remote-Address,Save-Data,Server,Set-Cookie,Strict-Transport-Security,Timing-Allow-Origin,Transfer-Encoding,Upgrade-Insecure-Requests,User-Agent,Vary,Viewport-Width,Width,X-Backend-Server,X-Cache-Info,X-Content-Type-Options,X-CustomHeader,X-Forwarded-For,X-Forwarded-Host,X-Forwarded-Port,X-Forwarded-Proto,X-Forwarded-Server,X-Frame-Options,X-HTTP-Method-Override,X-Kuma-Revision,X-Modified,X-OTHER,X-Permitted-Cross-Domain-Policies,X-PING,X-PINGOTHER,X-Powered-By,X-Real-IP,X-Requested-With,X-XSS-Protection"
Header   set   Access-Control-Allow-Credentials    "true"
Header   set   Timing-Allow-Origin                 "*"
Header   set   X-Permitted-Cross-Domain-Policies   "all"

Note that both Access-Control-Allow-Headers and Access-Control-Expose-Headers lack the options of having * as a value, to this reason their value is quite a long string of the most common used HTTP header-names (collected by me…).
Some hosting/servers might have issues with such a long header-value,
you can try to split the value in half, using two headers
in some cases you’ll need to shorten things up,
in case the length of the HTTP header-value is too long for your server.

You could try splitting the value into two calls using add:

Header   add   Access-Control-Allow-Headers        "Accept,Accept-Charset,Accept-Encoding,Accept-Language,Access-Control-Allow-Credentials,Access-Control-Allow-Headers,Access-Control-Allow-Methods,Access-Control-Allow-Origin,Access-Control-Expose-Headers,Access-Control-Max-Age,Access-Control-Request-Headers,Access-Control-Request-Method,Alt-Svc,Cache-Control,Connection,Content-Description,Content-Encoding,Content-Language,Content-Length,Content-Security-Policy,Content-Transfer-Encoding,Content-Type,Cookie,Date,DNT,Downlink,DPR,Expires,Host,If-Modified-Since"
Header   add   Access-Control-Allow-Headers        "Keep-Alive,Last-Event-ID,Last-Modified,Origin,P3P,Pragma,Referer,Referrer-Policy,Remote-Address,Save-Data,Server,Set-Cookie,Strict-Transport-Security,Timing-Allow-Origin,Transfer-Encoding,Upgrade-Insecure-Requests,User-Agent,Vary,Viewport-Width,Width,X-Backend-Server,X-Cache-Info,X-Content-Type-Options,X-CustomHeader,X-Forwarded-For,X-Forwarded-Host,X-Forwarded-Port,X-Forwarded-Proto,X-Forwarded-Server,X-Frame-Options,X-HTTP-Method-Override,X-Kuma-Revision,X-Modified,X-OTHER,X-Permitted-Cross-Domain-Policies,X-PING,X-PINGOTHER,X-Powered-By,X-Real-IP,X-Requested-With,X-XSS-Protection"

Header   add   Access-Control-Expose-Headers       "Accept,Accept-Charset,Accept-Encoding,Accept-Language,Access-Control-Allow-Credentials,Access-Control-Allow-Headers,Access-Control-Allow-Methods,Access-Control-Allow-Origin,Access-Control-Expose-Headers,Access-Control-Max-Age,Access-Control-Request-Headers,Access-Control-Request-Method,Alt-Svc,Cache-Control,Connection,Content-Description,Content-Encoding,Content-Language,Content-Length,Content-Security-Policy,Content-Transfer-Encoding,Content-Type,Cookie,Date,DNT,Downlink,DPR,Expires,Host,If-Modified-Since"
Header   add   Access-Control-Expose-Headers       "Keep-Alive,Last-Event-ID,Last-Modified,Origin,P3P,Pragma,Referer,Referrer-Policy,Remote-Address,Save-Data,Server,Set-Cookie,Strict-Transport-Security,Timing-Allow-Origin,Transfer-Encoding,Upgrade-Insecure-Requests,User-Agent,Vary,Viewport-Width,Width,X-Backend-Server,X-Cache-Info,X-Content-Type-Options,X-CustomHeader,X-Forwarded-For,X-Forwarded-Host,X-Forwarded-Port,X-Forwarded-Proto,X-Forwarded-Server,X-Frame-Options,X-HTTP-Method-Override,X-Kuma-Revision,X-Modified,X-OTHER,X-Permitted-Cross-Domain-Policies,X-PING,X-PINGOTHER,X-Powered-By,X-Real-IP,X-Requested-With,X-XSS-Protection"

And you can also simply remove some…

In additional to the permissive CORS HTTP Headers,
which will suite HTML5 and newer web-programming-
– you can add permissive CrossDomain.xml and ClientAccessPolicy.xml,
which will add support for Adobe (Macromedia) Flash, Flex and .NET’s Silverlight to your website.

And thanks to using X-Permitted-Cross-Domain-Policies set to all you will be able to place those two xml file in any sub-path you’ll like (normally they are limited root/sub-domain’s root).

Fiddler4 Direct Download LInk

Latest version (very slow…)

A Download Mirror (not always the latest version but “will do”…)


More information:

After the installation, follow the instructions here:
https://github.com/eladkarako/mods/blob/master/Fiddler it has a slightly modified exe and dll files with improved performances and Windows-10 support.

Segoe-UI For The Web From Skype

Install Skype,
once done look for Skype.msi around your PC. Either %TEMP% or %ProgramData%\Skype\{ ...a long string of characters... } would be most likely to have it, download 7-Zip and open Skype.msi,
look for Product.cab (open it) and login.cab (open it too),
select all of the content, drag&drop it to your desktop.

Sometimes you’ll find the login.cab‘s content has already extracted to %UserProfile%\AppData\Local\Skype\Apps\login\ or %LocalAppData%\Skype\Apps\login\, it is usually happens after you first login to your account, as a cache (but the MSI-extraction method above is better..)

The fonts and css folders is what your want, you can use it for testing and private stuff on your PC. For the web you should probably buy a server-licence from M$…

Here are some screenshots:

Edit:This trick will work for old installation of Skype,
version 74.85.102 from April 2015 will do just fine,
you’ll probably won’t be able to extract the login.cab,
or have a login folder in newer versions.
Try using FileHippo.

also available here: gist.github.com/eladkarako/93b8ca176eb150bd7408f107e9f2d59e.

JavaScript – Array Of Objects Unique/Remove Duplicates, With Support For Complex Objects (Such As DOM Elements)

JavaScript – array unique, with support for NodeList (the result of document.querySelectorAll), with support for custom “unique by” for array of objects by theirs properties (for example array or NodeList of <A> elements which can be uniquified or removed duplicates by their absolute HREF attribute)

The unique_by_fn is not restricted,
you can render any output (text recommended) to uniquely-identify an object, in the tmp {} storage.
-also the usage of {} and keys as a way of storing object is highly efficient!

Array.prototype.unique = function(unique_by_fn){  //optional: unique_by_fn to ""identify"" an object (for example "function(obj){return obj.href}" to unique identify <A> elements)
  var me  = this

  tmp = me.reduce(function(carry, item){  //remove duplicates
    var unique_by = "function" === typeof unique_by_fn ? unique_by_fn(item) : item;
    carry[unique_by] = item;
    return carry;

  tmp = Object.keys(tmp).map(function(key){
    return tmp[key];

  return tmp;
NodeList.prototype.reduce = Array.prototype.reduce;
NodeList.prototype.unique = Array.prototype.unique;

function unique_by_href(element){
  return element.href || "";

var QUERY = 'div[id*="program-head"] div[class*="link-container"] a[href*="download_"][href*="download/"]';


also available on this gist:

YouTube Videos Downloading – MultiProcess, MultiPart, Text-File List Supported Using Aria2C And YouTube-DL

You really should switch from using the native/ffmpeg download of YouTube-DL,
to using an external-downloader that can handle opening many-connections.

Here is an example of using aria2c with some arguments,
with YouTube-DL (it already implemented all of aria2c method).

call youtube-dl.exe --force-ipv4 --geo-bypass --verbose --print-traffic --no-call-home --no-check-certificate --prefer-insecure --external-downloader aria2c --external-downloader-args "--file-allocation=prealloc --human-readable=true --enable-color=true --split=16 --auto-save-interval=10 --retry-wait=2 --max-tries=3 --timeout=120 --connect-timeout=300 --max-file-not-found=1 --continue=true --allow-overwrite=false --auto-file-renaming=false --check-integrity=false --enable-http-keep-alive=true --enable-http-pipelining=true --disable-ipv6=true --connect-timeout=120 --max-concurrent-downloads=16  --max-connection-per-server=16"  "YOUR_VIDEO_URL"

If you wish to have yourself a way of downloading many YouTube videos,
in parallel, and in multipart to maximise your bandwidth usage and saving some time,
use the following github repository:

It already includes the binary files you need (youtube-dl.exe and aria2c.exe),
so all you have to do is copy&paste some URLs into the videos.txt and double-click videos.cmd.