aria2c Sample – Chromium Command-Line Switch Updater

Getting the most updated command-line switches for Chromium (Google-Chrome base code) is always a work in progress,
since this is a `live code` you can never say “Ok, I’m Done”, there will always be a new one, or old one retired from being actively used in the, well.., actual code.
So if you’re relaying on command-line switches in your scripts, or just want to try out new features before the `bleed into` the actual Google-Chrome main version, you probably want to bookmark this article :]]

Continue reading

AdBlock Rule To Block Ping And Beacon Requests

*$important,beacon

Compatible with every adblocking plugins, that supports the adblock-rule format.

You probably want to uninstall AdBlock and install uBlock Origin. AdBlock had sold out :/

JavaScript Character Encoder/Replacer For Unicode And Common-Characters To HTML-Entity

extending my previous article: HTML-Entity – Minimal Common
Prepare Yourself For MASSIVE/Excessive Characters’-ESCAPING…

<script>
(function(window, document, s, common_regex, common_map_replace, unicode_regex, unicode_replace){   "use strict";
  while("string" === typeof s && s.length > 0){
    s = s.replace(common_regex,  function(character){ return common_map_replace[character]; });  //replacing specific characters.
    s = s.replace(unicode_regex, unicode_replace);                                               //replacing unspecific unicode-range characters with each-character's-Hexadecimal value.
    s = window.prompt(
          "HTML-Entity Result" + "\n" + 
          "(Input More, Or Hit [ESC] To Quit)"
         ,s
        );
  }
}(
  top
, top.document
, "Example"
, new RegExp(               //common_regex
           "["
           +[
              "\\\\t"  , "\\\\n"  , "\\\\v"  , " "      , "\\\\&"  , "\\\\'"  , "\\\\*"
            , "\\\\:"  , "\\\\,"  , "\\\\@"  , "©"      , ""      , "°"      , "\\\\$"
            , "\\\\"   , ""      , "\\\\ˆ"  , "\\\\="  , "\\\\`"  , "\\\\>"  , "\\\\^"
            , "\\{"    , "\\\\["  , "_"      , "\\\\("  , "\\\\<"  , "\\\\-"  , "\\\\#"
            , "\\\\%"  , "\\\\."  , "\\\\+"  , "\\\\?"  , "\\\\\"" , "\\}"    , "®"
            , "\\)"    , "\\]"    , ";"      , "\\\\~"  , "\\\\/"  , ""      , "\\|"
            ].join("")
           +"]"
           ,"ugi")

, { "\t":  "&#9;"           //common_map_replace
  , "\n":  "&#10;"
  , "\v":  "&#11;"
  , " ":   "&#32;"
  , "&":   "&amp;"
  , "'":   "&apos;"
  , "*":   "&ast;"
  , "\\":  "&bsol;"
  , "":   "&bull;"
  , "ˆ":   "&circ;"
  , ":":   "&colon;"
  , ",":   "&comma;"
  , "@":   "&commat;"
  , "©":   "&copy;"
  , "":   "&curren;"
  , "°":   "&deg;"
  , "$":   "&dollar;"
  , "=":   "&equals;"
  , "`":   "&grave;"
  , ">":   "&gt;"
  , "^":   "&Hat;"
  , "{":   "&lbrace;"
  , "[":   "&lbrack;"
  , "_":   "&lowbar;"
  , "(":   "&lpar;"
  , "<":   "&lt;"
  , "-":   "&minus;"
  , "#":   "&num;"
  , "%":   "&percnt;"
  , ".":   "&period;"
  , "+":   "&plus;"
  , "?":   "&quest;"
  , "\"":  "&quot;"
  , "}":   "&rcub;"
  , "®":   "&reg;"
  , ")":   "&rpar;"
  , "]":   "&rsqb;"
  , ";":   "&semi;"
  , "~":   "&sim;"
  , "\/":  "&sol;"
  , "":   "&trade;"
  , "|":   "&vert;"
  }

, /[\u0080-\u10FFFF]/ug     //unicode_regex

, function(character){      //unicode_replace
    return "&#x"
           + ("0000" + c.charCodeAt(0).toString(16).toUpperCase()).substr(-4)
           + ";";
  }
));
</script>

..excessive escaping (even when required..) always makes me smile and remember the good old XKCD comics..

:]

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 : "";

  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, decimals)) / Math.pow(10, decimals);  //round digits
  
   
  return String(bytes) + sap + size[factor];
}



human_readable_bytes_size(29)
//"29B"
human_readable_bytes_size(29000000000000000)
//"25.75PB"
human_readable_bytes_size(2900000000000)
//"2.63TB"
human_readable_bytes_size(290000000000)
//"270.08GB"
human_readable_bytes_size(290000000000,5)
//"270.08354GB"
human_readable_bytes_size(290000000000,5,"---")
//"270.08354---GB"

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! ;] ;]

Mozilla FTP – Download Latest Firefox

Latest (~sort of~ “nightly”) Firefox Developer Edition, Code-Name `Aurora`
https://ftp.mozilla.org/pub/firefox/nightly/latest-mozilla-aurora/

This is the full offline-installer, not the `installer-stub` you get from the official website.


Latest Nightly-Build from trunk Firefox
https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/

You can download a localised (or “localized”.. if you’re an American..) language-specific version on https://ftp.mozilla.org/pub/firefox/nightly/latest-mozilla-aurora-l10n/.


Latest Beta
https://ftp.mozilla.org/pub/firefox/nightly/latest-mozilla-beta-l10n/

It seems that there is no generic package so you must choose one of the localised-packages,
for example https://ftp.mozilla.org/pub/firefox/nightly/latest-mozilla-beta-l10n/firefox-47.0.en-GB.win64.installer.exe or https://ftp.mozilla.org/pub/firefox/nightly/latest-mozilla-beta-l10n/firefox-47.0.en-GB.win64.zip


You may also download ESR (extended support release) for latest or not-so latest versions of Firefox, which is mostly useful if you don’t want to keep updating the core-browser’s version a lot..
Version 45: https://ftp.mozilla.org/pub/firefox/nightly/latest-mozilla-esr45-l10n/
And version 52: https://ftp.mozilla.org/pub/firefox/nightly/latest-mozilla-esr52-l10n/

Here too, you must choose a localised-download..


Browser https://ftp.mozilla.org/pub/firefox/nightly/ for “by date” downloads or any other variation of Firefox you may download, in-full.

HTML Snippet – 100% Fill Textarea-Page

The base of numerous of custom HTML-components
and functional pages is a “textarea page” which consist of
a (surprise surprise..) <textarea> element
and some sort of functionality integrated by a form-submit, JavaScript,
or a mix of both.

Continue reading

Delete A Lot Of WordPress Tags

No Need To Directly Access The DB Or Execute Any SQL Commands (Although It Would Be A Lot Faster…)

Edit a post, open the developer-panel,
switch to “console” and execute this code to delete 15 tags at once.. ;)

Really just a dirty dirty way :))

var x = document.querySelectorAll('.tagchecklist .ntdelbutton');
x[0].focus();  x[0].click();
x[1].focus();  x[1].click();
x[2].focus();  x[2].click();
x[3].focus();  x[3].click();
x[4].focus();  x[4].click();
x[5].focus();  x[5].click();
x[6].focus();  x[6].click();
x[7].focus();  x[7].click();
x[8].focus();  x[8].click();
x[9].focus();  x[9].click();
x[10].focus(); x[10].click();
x[11].focus(); x[11].click();
x[12].focus(); x[12].click();
x[13].focus(); x[13].click();
x[14].focus(); x[14].click();
x[15].focus(); x[15].click();

Deleting them all is kind-of weird: since querying for elements and “deleting” the current element actively changes the list of elements,
we can use the initial query to count roughly how much element were left, looping and querying the first element and removing it –
– keeping querying and removing a single element while the main loop “just checks if there are any still existing”.
– it will take just few minutes for couple of hundreds of tags, and the window might hang for a bit (don’t kill it.. just keep on waiting :/)
and at the end of the run you’ll have 100% post :]

here is it.. plus an alternative for the click method before.

function emu_click_new(target){
  if("object" !== typeof target) return;
  target.dispatchEvent(
    new MouseEvent("click", { screenX:    0     /*MouseEvent  [https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent] */
                            , screenY:    0
                            , clientX:    0
                            , clientY:    0
                            , ctrlKey:    false
                            , shiftKey:   false
                            , altKey:     false
                            , metaKey:    false
                            , button:     0     /*left button       */
                            , buttons:    0     /*no sticky press   */
                            , view:       self  /*UIEventInit [https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/UIEvent]       */
                            , bubbles:    true  /*EventInit   [https://developer.mozilla.org/en-US/docs/Web/API/Event/Event]           */
                            , cancelable: true
                            , scoped:     false
                            , composed:   false
                            }
                  )
  );
}

document.querySelectorAll('.tagchecklist .ntdelbutton').forEach(function(e){
  setTimeout(function(){
    e = document.querySelector('.tagchecklist .ntdelbutton');
    emu_click_new(e);
  }, 100);
});

.htaccess CORS

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 set Access-Control-Allow-Methods      "CONNECT,GET,HEAD,OPTIONS,PING,POST,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,Cache-Control,Connection,Content-Description,Content-Encoding,Content-Language,Content-Length,Content-Transfer-Encoding,Content-Type,Cookie,Date,DNT,Expires,Host,If-Modified-Since,Keep-Alive,Last-Modified,Origin,Pragma,Referer,Remote-Address,Server,Set-Cookie,Timing-Allow-Origin,Transfer-Encoding,User-Agent,Vary,X-Content-Type-Options,X-CustomHeader,X-Forwarded-For,X-Forwarded-Host,X-Forwarded-Port,X-Forwarded-Proto,X-Forwarded-Server,X-HTTP-Method-Override,X-Modified,X-OTHER,X-PING,X-PINGOTHER,X-Powered-By,X-Real-IP,X-Requested-With"
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,Cache-Control,Connection,Content-Description,Content-Encoding,Content-Language,Content-Length,Content-Transfer-Encoding,Content-Type,Cookie,Date,DNT,Expires,Host,If-Modified-Since,Keep-Alive,Last-Modified,Origin,Pragma,Referer,Remote-Address,Server,Set-Cookie,Timing-Allow-Origin,Transfer-Encoding,User-Agent,Vary,X-Content-Type-Options,X-CustomHeader,X-Forwarded-For,X-Forwarded-Host,X-Forwarded-Port,X-Forwarded-Proto,X-Forwarded-Server,X-HTTP-Method-Override,X-Modified,X-OTHER,X-PING,X-PINGOTHER,X-Powered-By,X-Real-IP,X-Requested-With"
Header set Access-Control-Allow-Credentials  "true"
Header set Timing-Allow-Origin               "*"

eBay Bad Sellers

There are plenty of “Bad-Buyers” websites,
for sellers to be adding to their “ignore list”,
but not much of (if any) “bad seller” lists,


From time to time you hear of a seller that sends partial-delivery,
Or even avoid sending anything at all (especially if you place a very small order),
After two or three months when you’ll send them a message,
They will act *all “surprised”* and if you are lucky you might get your money back,
that is, if they will bothered to answer you at all,
and it wasn’t too long until you’ve opened a case with either eBay/PayPal.

why wouldn’t you just avoid that scenario at all?
apparently my other article JavaScript Ninja – Crowd Wisdom eBay Enhancements was so popular, that I’ve actually got address by few of my blog-readers,
sharing some ‘horror’-stories about recent purchases,
We’ve had a new idea:

A seller blacklist

Continue reading

CSS3 Ninja – Pure CSS-KeyFrame Animation Example

An infinite, alternate animation converting a shape, with initial delay,
no javascript, pure css.

– centring the shape using the top0-left0-right0-bottom0-margin_auto trick.
– sizing the share using viewport

vw: 1/100th viewport width
vh: 1/100th viewport height
vmin: 1/100th of the smallest side
vmax: 1/100th of the largest side

HTML Entity – Infinite Convertion Bookmarklet Toolkit

javascript:(function(window, document, to_HTMLENTITY, s, is_everychar){  "use strict";
  while(true){
    s             = prompt("String To HTML-Entity.\nEnter Input String:", s);
    if(null === s) return;
    is_everychar  = prompt("String To HTML-Entity.\n[true] Convert Every Character.\n[false]Convert Just Unicode.", "false");

    prompt("HTML-Entity Result:", to_HTMLENTITY(s, "true" === is_everychar));
  }
}(
  top
, top.document
, function to_HTMLENTITY(s, is_everychar){
    var regex = true === is_everychar ? /./ug : /[\u0080-\u10FFFF]/ug
    return s.replace(regex, function(c){
      c = c.charCodeAt(0).toString(16).toUpperCase();
      c = ("0000" + c).substr(-4);
      c = "&#x" + c + ";";
      return c;
    });
  }
, ""
));

minified..

javascript:(function(window,document,to_HTMLENTITY,s,is_everychar){while(true){s=prompt("String To HTML-Entity.\nEnter Input String:",s);if(null===s)return;is_everychar=prompt("String To HTML-Entity.\n[true] Convert Every Character.\n[false]Convert Just Unicode.","false");prompt("HTML-Entity Result:",to_HTMLENTITY(s,"true"===is_everychar))}})(top,top.document,function to_HTMLENTITY(s,is_everychar){var regex=true===is_everychar?/./ug:/[\u0080-\u10FFFF]/ug;return s.replace(regex,function(c){c=c.charCodeAt(0).toString(16).toUpperCase();
c=("0000"+c).substr(-4);c="&#x"+c+";";return c})},"");

HTML ENTITY – Every Character VS. Just Unicode

function to_HTMLENTITY(s, is_everychar){ "use strict";
  var regex = true === is_everychar ? /./ug : /[\u0080-\u10FFFF]/ug
  return s.replace(regex, function(c){
    c = c.charCodeAt(0).toString(16).toUpperCase();
    c = ("0000" + c).substr(-4);
    c = "&#x" + c + ";";
    return c;
  });
}

HTML Entity – Unicode Escape

For Unicode only:

'Français'
  .replace(/[\u0080-\u10FFFF]/ug, function(c){
                                    return "&#x" + ("0000" + c.charCodeAt(0).toString(16)).toUpperCase().substr(-4) + ";" 
                                  });

output:

&#x0046;ran&#x00E7;ais

Continue reading

Google Domain2IP (DNS Over HTTPS)

https://dns.google.com/resolve?name=example.com

Will give you:

{"Status": 0,"TC": false,"RD": true,"RA": true,"AD": true,"CD": false,"Question":[ {"name": "example.com.","type": 1}],"Answer":[ {"name": "example.com.","type": 1,"TTL": 36524,"data": "93.184.216.34"}]}

You can see more switches at this version:
https://dns.google.com/query?name=example&type=A&dnssec=true

Read more:
https://developers.google.com/speed/public-dns/docs/dns-over-https

The Most Popular Adblock Lists

Adblock Warning Removal List                   https://easylist-downloads.adblockplus.org/antiadblockfilters.txt
Anti-Adblock Killer by Reek                    https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt
Blockzilla by zpacman                          https://raw.githubusercontent.com/zpacman/Blockzilla/master/Blockzilla.txt
EasyList                                       https://easylist.to/easylist/easylist.txt
EasyList Arabian                               https://easylist-downloads.adblockplus.org/Liste_AR.txt
EasyList Bulgarian                             http://stanev.org/abp/adblock_bg.txt
EasyList Chinese                               https://easylist-downloads.adblockplus.org/easylistchina.txt
EasyList Chinese CJX's Annoyance List          https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt
Easylist Czech/Slovak                          https://raw.githubusercontent.com/tomasko126/easylistczechandslovak/master/filters.txt
EasyList Dutch                                 https://easylist-downloads.adblockplus.org/easylistdutch.txt
EasyList French                                https://easylist-downloads.adblockplus.org/liste_fr.txt
EasyList Germany                               https://easylist.to/easylistgermany/easylistgermany.txt
EasyList Hebrew                                https://raw.githubusercontent.com/easylist/EasyListHebrew/master/EasyListHebrew.txt
EasyList Icelandic                             https://adblock.gardar.net/is.abp.txt
EasyList Indonesian                            https://raw.githubusercontent.com/heradhis/indonesianadblockrules/master/subscriptions/abpindo.txt
EasyList Italian                               https://easylist-downloads.adblockplus.org/easylistitaly.txt
EasyList Japanese                              https://raw.githubusercontent.com/k2jp/abp-japanese-filters/master/abp_jp.txt
Easylist Latvian                               https://notabug.org/latvian-list/adblock-latvian/raw/master/lists/latvian-list.txt
EasyList Lithuanian                            http://margevicius.lt/easylistlithuania.txt
EasyList Romanian                              https://www.zoso.ro/pages/rolist.txt
EasyList Russian                               https://easylist-downloads.adblockplus.org/advblock.txt
EasyList Spanish                               https://easylist-downloads.adblockplus.org/easylistspanish.txt
EasyList without element hiding rules          https://easylist-downloads.adblockplus.org/easylist_noelemhide.txt
EasyPrivacy                                    https://easylist.to/easylist/easyprivacy.txt
EasyPrivacy without international filters      https://easylist-downloads.adblockplus.org/easyprivacy_nointernational.txt
Fanboy's Annoyance List                        https://easylist.to/easylist/fanboy-annoyance.txt
Fanboy's Social Blocking List                  https://easylist.to/easylist/fanboy-social.txt
I don't care about cookies                     https://www.kiboke-studio.hr/i-dont-care-about-cookies/abp/
Prebake - Filter Obtrusive Cookie Notices      https://raw.githubusercontent.com/liamja/Prebake/master/obtrusive.txt

ImageMagick Nightly Builds

https://www.imagemagick.org/download/binaries/?C=M;O=D

Sadly there is no “latest” entry,
but you can sort by modification date,
(and even parse a digest.rdf to find-out the name of the latest build..)

and make-use of your browser’s [CTRL]+[F] to look for your prefered build,
for me it is the Windows x64 fully static, portable Q16, the higher version (ver 7 given the choice between latest build of 6 or 7..).

Tips:
– use multi-part download manager if you want to download with speed-rates greater than 80KB/S
– use http instead of https prefix to avoid the ssl hand-shake and download faster on download-managers such as OrbitDownloader :)
– you can find Android compatible builds if you want to give your mobile-phone the power of the gods… :))


It is a bit messy to find the correct download since it does not separated properly,
but you may run the following line in the developer’s-panel’s console:
document.querySelectorAll('[href*="portable"]:not([href$="asc"])').forEach(function(element){ console.log(element.href); })

to get just the useful ones:
For Windows x64 (64-bit):
https://www.imagemagick.org/download/binaries/ImageMagick-7.0.4-5-portable-Q16-x64.zip
https://www.imagemagick.org/download/binaries/ImageMagick-6.9.7-5-portable-Q16-x64.zip

For Windows x86 (32-bit):
https://www.imagemagick.org/download/binaries/ImageMagick-7.0.4-5-portable-Q16-x86.zip
https://www.imagemagick.org/download/binaries/ImageMagick-6.9.7-5-portable-Q16-x86.zip

JavaScript Ninja – document.write Alternative

If you use document.write to write an entire new document,
Chrome might apply a security-policy, warning or even blocking every internal-script you have.

As an alternative, only use document.write to write the doctype,
and set the HTML-source using document.documentElement.innerHTML = ".......".

Here is a working code you, that should be loaded after the document has ready but before it rendered (a.k.a DOMContentLoaded or at_document_end if you are doing this in Chrome’s extension).

Continue reading

Chrome Extension Snippet – Modify Response Header

If you would like to ‘fake give yourself CORS’ for every request, modify cookies to remove the ‘http’ only directive so you could always edit cookies using javascript, or perhaps just add an X-Hello: World header to every response you get from anywhere, to fool your browser to think it is the real thing, got from a foo-server,
– here is what you need to do:
Continue reading

FFMPEG – Pre-Fill File Duration Into FFMPEG’s MP3-Concatenation File-List, Using FFPROBE

This is will generate a text file filed with all the mp3 files in the folder,
it will also PRE QUERY each file using FFPROBE and will add the result to the file,
helping to avoid sync-or-duration problems.

ffprobe supports built-in formatting, which might help you avoid using external commands such as cut, sed, grep, etc… .

Continue reading

JSON.stringify With Escape For Unicode-Characters

You may be familiar with PHP’s json_encode which allows you to do wonderful things such as giving you a ASCII safe version of Unicode-content (which is the default, and if you actually do want to return a plain Unicode content you need to specify JSON_UNESCAPED_UNICODE flag).

In your browser (or NodeJS in that matter..) JSON.stringify do not include a built-in parser for you to use, but it DOES include an option to specify a “replacer” function, which acts as the parser, naturally there is a lot more free-ground to play around, but if the only thing you need is something similar to PHP’s json_encode read ahead..

A nifty little trick I’m going to use next is a regular-expression replacing using Unicode values of all characters with code above 160 (decimal) to the maximum value for a single Unicode-character which is 65535.
Although we can tolerate character-values of up until 255, those above 160 are generally not-considered ASCII safe, and includes special control-characters and language-directional control which might break the text-stream.

Continue reading

Aria2C Example Download Script To Download Latest FFMPEG

aria2c https://aria2.github.io/ is a console-multi-part download manager, very similar to cURL or wGET. It also allow you to download a single file, using multiple-partial segments, downloading the whole thing much faster (assuming the host isn’t limiting download speed by IP, or block multipart downloads).

It also allows you to download same file from different hosts (for example a Ubuntu ISO, from few mirrors), or, simply multiple-files, from same and or different hosts with the additional of using http-pipeline to save on bandwidth, there are more stuff..

The multipart-download, may replace download-managers such as FlashGet, OrbitDownloader or (in some cases) jDownloader, mostly because it is simply script’able, you can even launch “callbacks” on several pin-points in download timeline.

I use it in plain Windows-CMD batch file, to download the latest FFMPEG from https://ffmpeg.zeranoe.com/builds/, including an unzip action at the end and moving some of the core-files.

There is an optional log.txt file creating, which may be useful for debug..
pre-locating using falloc is mostly for NTFS (not FAT32!) and newer file-OS,
You may download aria2c, and run it with --help for all of the other switches..

Continue reading

Ƀ – BitCoin Emoji

For HTML, use the HTML-entity: &#579;.
In additional you may add the Unicode directive to make sure it always render as text &#579;&#65038; (need to be close together).

For Java/JavaScript/etc.. you can use its Unicode-encoded form \u0243 (or \u0243\uFE0E).

The easiest way of including the BitCoin-character is by simply copying the raw Unicode character:

Ƀ

Continue reading

How To Make Sure Your WordPress Plugin Is Aware Of Where It Is Running, As Early As Possible (Feed, Atom, JSON, WP-Admin, sitemap.xml, Static-Resource, An Article Or A Page)

You want to know as early as possible if you are ‘running from within’ Atom, feed, sitemap.xml, etc..

It is not always easy to tell where exactly ‘are you’ when executing from within a WordPress-plugin,
since a lot of what seems to be a static resource at first, such as the following url: http://icompile.eladkarako.com/sitemap.xml is really too rendered by using the WordPress’ template-engine,

If a resource is using the WordPress template-engine, it uses index.php as its entry point to the WordPress system,
from there, which is actually the same point-of entrance as, for example one of your articles.

Identifying “what is it am I watching right now” is quite important especially if your WordPress-plugin is doing a content-specific action, for example editing an HTML content of the page, it is most certainly not fitted for an XML-content, for example, if you are currently visiting sitemap.xml. It might even break it!

Few of my plugins, do, in-fact modify a raw-HTML content,
and for that they are being loaded as the LAST plugin in the page’s rendering-life-cycle.

WordPress-platform does include is_home, is_front_page and similar “is..?” functions, but they are too poor quality, and often requires being “in-the-loop” or querying the database, or generally-speaking “being too late” in the page-rendering life cycle.

There are simple, efficient (and somewhat heuristic) ways of knowing if your WordPress plugin should be “working on that content” or just skip, leaving the content unmodified.

As a rule-of-thumb you do not want to work on static-like contents (JSON, XML), neither working on admin-pages or anything that has not passed-through the WordPress template-engine (the request started, by the index.php entry-point).

Here is a partial segment of the code I am using on one of my WordPress plugins that minifies the entire HTML code:

Continue reading

CSS3 Snippet – Everything To Button

[button]{
  text-decoration: none;
  padding:         2pt 8pt;
  display:         inline-block;
  border:          1px solid gray;
  border-radius:   5px;
  outline:         none;
}
[button]{        background-image: linear-gradient(white, gray);     }
[button]:hover{  background-image: linear-gradient(gray, white);     }
[button]:active{ background-image: linear-gradient(gray,gray, white);}

and practically just add a button attribute to anything you want..

<a button ....
<div button ....
<span button ....

Tips:
– Add cursor: pointer; to the button{ ... style-block, to give a clickable-impression (not required if you are using an already clickable element such as <A>.
– Add user-select: none !important; to the button{ ... style-block, to give a smooth click experience without selecting the text of the button, alternatively you can put the text in button:before{ content: '...HERE...'.

Unofficial ApkTool 🔧

ApkTool, smali, baksmali, and a few other libs you need in-order to inspect or reverse-engineer a compiled, signed and possibly protected APK files. other essentials).

Continue reading

Java Snippet – Read Entire File (Including EOL Characters!) Not Line-By-Line And Without Loops!

This nice technique reads the file `as is`,
it even keeps the internal EOL characters (`\r\n`, `\n`,..)

It requires no external-libraries and even compatible with Java7!

Forget the entire awkward combination of InputStream, FileInputStream, FileReader, InputStreamReader and BufferedReader
and those embarrassing readline() loops!

Continue reading

JavaScript Ninja – The State Of Window

Here is a simple quick&&dirty way of checking the state of the global-scope (window/top/self/…),
but you may apply the logic to any object, or even run the main method recursively to provide a compare status, as deep as required..

I’m going for a clear-example stuff, comparing before and after of one direct-layer of *stuff* added/removed into window.

It is especially useful for reverse-engineering a long and complicated, possibly obfuscated code,
which is too complex to view, but – naturally – will be much simpler to just see the result/effect on the DOM.

Continue reading

JavaScript Snippet – Format As Unicode String (“\u..”)

function to_unicode_format(str){
  str = "\\u"  +  str.split("").map(function(c){
                    c = c.charCodeAt(0);
                    c = c.toString(16);
                    c = ("0000" + c).substr(-4)
                    return c;
                  }).join("\\u");
  return str;
}

In this case using the unescape(encodeURIComponent("א")); to pre-format the character into a valid byte string (and later using decodeURIComponent(escape(.......)); to convert it back from byte-string) is not required at all,
The method above supports input in all of the Unicode-encoded character-sets (“א”,…),
and will output a valid (ASCII compatible) Unicode-formatted characters that looks like \u.....

bookmarklet version (yet so much minified):

javascript:(function(s){
  s = prompt("∞ to Unicode-Format:","❝Likė A Ƀoŝš❞");
  if(null === s || "" === s) return;
  s = "\\u"
      + Array.prototype.map.call(s, function(c){
                                      return ("0000" + c.charCodeAt(0).toString(16)).substr(-4);
                                    }).join("\\u");
  prompt("output:",s);
}());

bookmarklet minified:

javascript:(function(s){if(null===s||""===s)return;s="\\u"+s.split("").map(function(c){return ("0000" + c.charCodeAt(0).toString(16)).substr(-4);}).join("\\u");prompt("output:",s);}(prompt("∞ to Unicode-Format:","❝Likė A Ƀoŝš❞")));

Chrome Extensions With JavaScript, On Pages With No JavaScript

Chrome Extension Developers – setTimeout/setInterval Won’t Work On Pages With No JS Support!

While javascript will work just fine as general,

everything you put in window/self/top/etc.. and methods from window object such as setTimeout/setInterval will not be executed if the page has no-JavaScript support, this happens if the user has JavaScript disabled in its browser, or if the page has a hard-set policy (by HTTP headers),

But if you’ll be smart you could still execute your javascript on 3 page-life-cycle events – start (before content), end (DOMContentLoaded) and idle (after window.onload),

you can include a call to setTimeout/setInterval in your code, in addition to a regular-standard method call,

for your convenient, you can place all your variables and main functions in javascript that loads at the `initial` state in the page’s life-cycle,
make sure not to atach it in any way to the window object (for example instead of window.my_function = function(... use simply function my_function(..,
and it will be available for you to use and reuse in all of the other javascript files, as part of your chrome-extension scope,

this means Chrome WILL ALLOW you to load as much javascript as you want into pages “with no javascript support”,
as long you avoid (or just make optional) the use of setInterval/setTimeout and other “hard”-related window functions and attributes.

You can see a full working example on how to make such extension, that will optionally use the setInterval method,
but with basic functionality that will work just fine on pages with no javascript support on my github page
(Just look for any repositories starting with the name `Chrome-Extension-..`).

Here is one example of an extension that uses XMLHTTPRequest (xhr),

that works perfectly fine for pages with no javascript, although I AM including an improved execution, done with setInterval (that will be executed every 500 milliseconds), I do not relay on it, and do call for the main action on the 3 states that I able to (start ideal and end).

How To Update Your Gist File

You might have looked for an “edit” buttons…

You better avoid that, and just clone, change, commit and push it.

How?

at your gist page, near the top right switch from embed to clone (with HTTPS),

Now simply copy the URL and clone it on your desktop, when done, simply commit and push it,
it be will added to the list of revisions.