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.

CORS

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).

Java And UTF-8

When running a java application,
make sure to use -Dfile.encoding=UTF8,
for an 8-bit Unicode-support.

Interaction with standard input/output
requires setting the output’s code-page too.

For Windows run: chcp 65001 before you execute java.

For Unix/Linux: export LC_ALL="en_US.UTF-8".


Here is an example of a Windows batch-file named apktool.cmd,
that wraps around a jar-program named apktool.jar:

@echo off
chcp 65001 2>nul >nul
call java.exe "-d64 -Xverify:none -Duser.language=en -Dfile.encoding=UTF8" -jar "%~dp0\apktool.jar" %*

and here is why it is important to specify the output’s encoding: github.com/iBotPeaches/Apktool/issues/1595


Reader classes are now covered, for Writer classes make sure to explicit use UTF-8.
prefer using OutputStreamWriter (instead of FileWriter which does not support explicit charset):

BufferedWriter out = new BufferedWriter(
                       new OutputStreamWriter(
                         new FileOutputStream(path)
                        ,"UTF-8"
                       )
                     );

Some swear by explicit providing and additional reader/writer set,
so here is that too:

 OutputStreamWriter char_output = new OutputStreamWriter(
     new FileOutputStream("some_output.utf8"),
     Charset.forName("UTF-8").newEncoder() 
 );

 InputStreamReader char_input = new InputStreamReader(
     new FileInputStream("some_input.utf8"),
     Charset.forName("UTF-8").newDecoder() 
 );

which can be specified to handle input-error, which is sometime useful..

CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder();
encoder.onMalformedInput(CodingErrorAction.REPORT);
encoder.onUnmappableCharacter(CodingErrorAction.REPORT);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("jedis.txt"),encoder));

Everything here is considered quite-safe to use,
since 8-bit Unicode (UTF-8) will still allow a fallback to displaying
characters out-of US-ASCII (for example) without the need for adding an
extra BOM bits, unlike UTF-16…

Enjoy!

Modification For default.prop (“from boot”) / build.prop (“from system”)

Done for cm_golden-userdebug 7.1.2 NJH47F db0312e049 release-keys/RR-N-v5.8.4-20170821-golden/rr7.1_golden.nova.20170822.zipNougat 7.1.2 (Resurrection Remix) 20170822, for Samsung Galaxy S3-Mini NFC (I8190N).
The base of the partition-structure is from I8190NXXAMI1_I8190NILOAMJ2_HOME.

It will disable the Security-Enhanced Linux (SELinux)🔗︎ and newly Android 7.0 added dalvik's ART Just-In-Time (JIT)🔗︎, the SELinux will be set to permissive settings, just in-case it will be enabled in the future. The modification will allow mtp and adb access from boot and recovery, so you could access your phone at that stage too, it will resolve some WiFi and cast problems and will allow ADB access without annoying popups (default allowed), knox is disabled too but it won’t do much on the custom ROM (unless you’ll be manually download KNOX to access Samsung-pay, which in this case it could be useful to keep it anyway).

Continue reading

CMD NewLine Character

set NEWLINE=^& echo.
echo hello%NEWLINE%world

And You’ll get

Hello
World

Manually Removing Fonts From Windows, And Refreshing The Windows Font-Cache Storage File

*Close/save any opened documents and programs since this process will require a restart at some point,
plus programs/documents may attach hooks, locking the font-folder and its content.

First, stop the services FontCache3.0.0.0 (Windows Presentation Foundation Font Cache 3.0.0.0) and FontCache (Windows Font Cache Service), and set the their startup-type to “disabled” (just for those few moments…)

Stopping those services, will allow you an easier access to the C:\Windows\Fonts folder,
without those processes constantly accessing the fonts-folder.

next use task-manager to stop explorer.exe processes, which will unhook most of the hooks set to the C:\Windows\Fonts folder (including the files inside it..)

Use unlocker to unlock any of the remaining hooks,
and any way of browsing for files such as FAR-commander or even Locate32, to help you delete any of the font files you want.

It is best to make a backup-copy of the entire folder, including all of the files inside,
just in-case.

Use CCleaner to automatically clean-up any registry-entries for the deleted-font files,

We’re almost done, and now it is time to delete the static-cache files for the font-folder,
so new ones will be created for the new folder-content.

Remove (or rename their extensions to .old) both FNTCACHE.DAT and StaticCache.dat which you’ll find under C:\Windows\System32\ and C:\Windows\SysWOW64\.

*Generating the new cache-files will be done automatically the next time the cache-services will start-up,
but we’ll let them start automatically after the next PC-restart.

Before restarting your PC,
switch the startup-type of both FontCache3.0.0.0 and FontCache to “automatic”,
without actually restarting them by yourself.

Quickly press [WINDOWS]+[R], to open-up the “run” dialog-box,
type restart -f -r -t 00 and press [ENTER].

The next time the computer will be up,
after you’ll log-into your account, the new cache-files will be created.

Ps.
You may even want to refresh the icon-cache for your desktop icons and such,
by running the following command: ie4uinit.exe -ClearIconCache (you’ll have to wait few moments for it to finish). No need to restart afterwards.

The entire process takes few moments but it will speed up your Windows-PC,
especially if you’ll end-up deleting a lot of unneeded font-files.


Here is a way of doing the same process, automatically,
and much faster…

Continue reading

Aria2C Batch File For Quick Download

Copy to following CMD batch-file content into a new file,
and name it aria2download.cmd.

Place the file in the same folder as your aria2c.exe,
make sure it is your system-PATH,

and you can now enter aria2download "http..your-url..."
for a quick file-download to the current folder you are in.

All the important-switches are already set, such as maximum split value, and maximum connections per-server for ultra-fast download and an extra permissive-SSL to allow you to download from secure-servers without certificate verifying and a browser-like useragent and referrer value to generate a compatible download session with servers that often will block download-managers. You can easily personalise the batch-file to include an additional headers, authentications, etc…

Continue reading

Download Latest BUSYBOX Binary For Android – Ready To Use!

https://www.busybox.net/downloads/binaries/

This version is pretty much the latest one you’ll see online: https://www.busybox.net/downloads/binaries/1.21.1/

But the real latest one (to date) binary (ready to use!) is this one:
https://www.busybox.net/downloads/binaries/1.26.2-defconfig-multiarch/

Continue reading

APKMirror.com Search

https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=YOUR_SEARCH_TERM

for example:
https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=whatsapp
or
https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=youtube
or
https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=swiftkey


naturally it would have been better if the website owners were embedding
the following script schema:

<script type="application/ld+json">
{
  "@context":           "http://schema.org"
, "@type":              "WebSite"
, "url":                "https://www.apkmirror.com/"
, "name":               "APKMirror - Free APK Downloads"
, "alternateName":      "Download Free Android APKs #APKPLZ"
, "logo":               "https://www.apkmirror.com/wp-content/themes/APKMirror/images/apple-touch-icon-180x180.png"
, "potentialAction": {  "@type": "SearchAction"
                     ,  "target": "https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s={search_term_string}"
                     ,  "query-input": "required name=search_term_string"
                     }
}
</script>

why it is important to a website to have this “thing” in the main index-page?
1. Desktop browsers (Chrome) will add the website with embedded search into the address-bar,
for example, I have (similar) application/ld+json in icompile.eladkarako.com,
which means I could start typing the URL following by SPACE and get a built-in search from within the browser:

2. it will work pretty well with mobile-browsers as well, saving typing and browsing-time to the website-visitor (which is a good thing).

3. it works well with Google search and other spiders, which will build-up a more efficient index/map of the website.

4. it is pretty much “the standard” (or at least a “best practice”) when designing a friendly, browse’able website.


once you’ve visited a website that has the application/ld+json code inside,
it should add it automatically to your website,
but you may also access that section, quite easily for manual editing:


Here are few more links :)
https://developers.google.com/search/docs/data-types/sitelinks-searchbox
https://schema.org/SearchAction
https://github.com/archon810/apkmirror-public/issues/18#issue-231810436

Make Chrome Faster

1. Use Chrome/Chromium Of x64bit, if your machine can handle it.

2. Install those both official Chrome-extensions:
https://chrome.google.com/webstore/detail/dalkfakmooljfejnddeaibdkgbbogpea
https://chrome.google.com/webstore/detail/pcgokfnmpaefeofjpbicabmcadpcnhon

3. Access chrome://flags/ and change the following values,
you may easily reach either of those by copy&&paste them into the address-bar.

👉 chrome://flags/#num-raster-threads ➧4
👉 chrome://flags/#default-tile-width ➧1024
👉 chrome://flags/#default-tile-height ➧1024

👉 chrome://flags/#enable-fast-unload ➧Enable
👉 chrome://flags/#smooth-scrolling ➧Disable
👉 chrome://flags/#enable-quic ➧Enable
👉 chrome://flags/#enable-zero-copy ➧Enable
👉 chrome://flags/#enable-site-per-process ➧Enable
👉 chrome://flags/#v8-cache-options ➧’Cache V8 parser data.’
👉 chrome://flags/#v8-cache-strategies-for-cache-storage
➧’Aggressive’
👉 chrome://flags/#enable-scroll-anchoring ➧Disable
👉 chrome://flags/#enable-pointer-events ➧Enable
👉 chrome://flags/#passive-listener-default ➧’Force All True’
👉 chrome://flags/#document-passive-event-listeners ➧Enable
👉 chrome://flags/#passive-event-listeners-due-to-fling ➧Enable
👉 chrome://flags/#expensive-background-timer-throttling ➧Enable
👉 chrome://flags/#enable-nostate-prefetch ➧’Enabled Prerender’
👉 chrome://flags/#enable-resource-prefetch ➧’Enable Prefetching’
👉 chrome://flags/#delay-navigation ➧Disable

4. Just before the restart required in stage [3] (above),
close all other tabs (other than chrome://flags/),
access chrome://net-internals/#dns in a new-tab, and click the ‘clear host cache’, you can safely close the chrome://net-internals/#dns now, and back in the chrome://flags/ click on the big-blue ‘relaunch now’ button.

5. Run Chrome with the following command-line switches:

--enable-accelerated-vpx-decode="0x03" --prefetch-search-results --disable-pinch --disable-in-process-stack-traces --enable-tcp-fastopen --enable-threaded-compositing --enable-gpu-scheduler --use-double-buffering --enable-hardware-overlays --enable-partial-raster --disable-speech-api --ipc-connection-timeout="90"  --enable-gpu-memory-buffer-compositor-resources --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers --disable-payment-request --disable-3d-apis --disable-logging --disable-presentation-api --enable-rgba-4444-textures --v8-cache-options="data" --v8-cache-strategies-for-cache-storage="aggressive"

you may use a .bat or .cmd batch file if it is easier for you,
or use my https://github.com/eladkarako/iniRun project.
here is my ini file (for chromium :])

[Information]
Parent_Folder=C:\Users\Elad\AppData\Local\Chromium\Application

Arguments=--force-device-scale-factor="1.2" --enable-accelerated-vpx-decode="0x03" --allow-outdated-plugins --ppapi-flash-path="C:\Windows\System32\Macromed\Flash\PEPFLA~1.DLL" --ppapi-flash-version="24.0.0.221" --prefetch-search-results --enable-lcd-text --enable-font-antialiasing=1 --ppapi-antialiased-text-enabled=1 --no-referrers --reduced-referrer-granularity --force-ui-direction=ltr --enable-pepper-testing --keep-alive-for-test --disable-pinch --ipc-connection-timeout="90" --disable-hang-monitor --disable-in-process-stack-traces --enable-tcp-fastopen --enable-threaded-compositing --enable-grouped-history --ash-md=enabled --material-design-ink-drop-animation-speed="fast" --show-md-login --top-chrome-md="material" --secondary-ui-md="material" --enable-gpu-scheduler --show-md-login --disable-md-oobe --use-double-buffering --desktop-window-1080p --enable-hardware-overlays --enable-partial-raster --disable-speech-api --enable-gpu-memory-buffer-compositor-resources --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers --disable-payment-request --disable-3d-apis --disable-logging --disable-presentation-api --enable-rgba-4444-textures --v8-cache-options="data" --v8-cache-strategies-for-cache-storage="aggressive" --enable-threaded-compositing --no-referrers


;;// Overrides the timeout, in seconds, that a child process waits for a
;;// connection from the browser before killing itself.
;;const char kIPCConnectionTimeout[]          = "ipc-connection-timeout";


Full_Path=C:\Users\Elad\AppData\Local\Chromium\Application\chrome.exe

Run_Mode=SW_SHOWMAXIMIZED

search this blog for newer ways to download all recent command-line switches and this might also help: https://github.com/eladkarako/Chrome-Command-Line-Switches :]

Enjoy!

Block Sockets? Ask Me How!

This Little Chrome Extension: https://github.com/eladkarako/Chrome-Extension-Socket-Killer
Acts As A Socket-Firewall, Blocking WebSocket Connections, Even Before Connecting!
As A Bonus, It Also Null’ifies The WebSocket Object-Constructor :]

Blocking websockets, prevents the next-gen. ads from infiltrating your- presumingly ads-protected, browser.

It will also improve your Ad-Blocking extensions, catching most ads, blocking more connections, etc..

Enjoy.

Adding ‘Noto Mono’, ‘Courier New’, ‘Droid Sans Mono’, ‘Roboto Mono’, ‘Ubuntu Mono’ To Windows’ CMD

Just make sure you have those (you can google-search them or look for them at fonts.google.com, the ‘Courier New’ font-face should be already installed in your Windows).

feel free to edit/replace/add more,
make sure the fonts are mono-type, use ‘000…00’ as name.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont]
"000"="Noto Mono"
"0000"="Courier New"
"00000"="Droid Sans Mono"
"000000"="Roboto Mono"
"0000000"="Ubuntu Mono"

If you don’t know of name of the font (it should be exactly right!),
open any program that does some sort of font selection, and allows copy&paste, such as Microsoft-Word or even Notepad2/Notepad++.

Notepad2 has a “default font” selection, which I’m not going to actually change, but just use it to browse-for font-names.

the standard control-panel, used by most (simple) does also allow easy copy&paste.