Friday, April 10, 2020

egpu





est your browser use which gpu?


https://egpu.io/forums/pro-applications/chrome-browser-not-using-egpu/







https://support.apple.com/en-us/HT208544


  1. Select the app in the Finder. Most apps are in your Applications folder. If you open the app from an alias or launcher, Control-click the app's icon and choose Show Original from the pop-up menu. Then select the original app.
  2. Press Command-I to show the app's info window.
  3. Select the checkbox next to Prefer External GPU.
  4. Open the app to use it with the eGPU.
You won't see this option if an eGPU isn't connected, if your Mac isn't running macOS Mojave or later, or if the app self-manages its GPU selection. Some apps, such as Final Cut Pro, directly choose which graphics processors are used and will ignore the Prefer External GPU checkbox.






Chrome browser not using eGPU

https://egpu.io/forums/mac-setup/catalina-not-using-my-blackmagic-egpu/

In multi-GPU systems, Chromium automatically detects which GPU should be used for rendering (discrete or integrated). This works 99% of the time, except when it doesn't - if a unavailable GPU is picked (for example, discrete graphics on VFIO GPU passthrough-enabled systems), chrome://gpu will complain about not being able to initialize the GPU process. On the same page below Driver Information there'll be multiple GPUs shown (GPU0, GPU1, ...). There's no way to switch between them in a user-friendly way, but you can read the device/vendor IDs present there and configure Chromium to use a specific GPU with flags:
$ chromium --gpu-testing-vendor-id=0x8086 --gpu-testing-device-id=0x1912
...where 0x8086 and 0x1912 is replaced by the IDs of the GPU you want to use (as shown on the chrome://gpu page).

How to specify command line flags

Let's say that you want to add two command line flags to chrome: --foo and --bar=2.
 Mac OS X
  1. Quit any running instance of chrome.
  2. Launch /Applications/Utilities/Terminal.app
  3. At the command prompt enter:
    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --foo --bar=2

Don't think of it too much.It's the NVIDIA driver.Probably is more restricted then in windows os,even under windows WEBGL is accelerated by your iGPU.You can visit this website(under Windows),go all the way to the bottom and you'll see something like that: ANGLE (Intel(R) HD Graphics 3000 Direct3D11 vs_5_0 ps_5_0) which means that the iGPU does most of the work.Nvidia's excuse is that if they allow their driver to accelerate  the browser on switchable graphics systems it will waste too much battery(i guess here is a good place to say: F#@%K NVIDIA).
You can try these flags combined with the the two mentioned above to see if it's possible to force it,if it's not you just have to leave with it: --supports-dual-gpus  --ignore-gpu-blacklist  --disable-gpu-driver-bug-workarounds  --use-angle=gl   --enable-gpu-scheduler
P.S. Remember to insert two(2) hyphen characters(dash) before the command line.For some reason when i post it here it's showing only one.

not sure if you still checking the replies here but if you do i think i found the proper command line switch:
--gpu-active-vendor-id=
--gpu-active-device-id=
 --gpu-active-vendor-id=   --gpu-active-device-id=
Unfortunately i can't test it due to being stuck with 378.92 driver which is the last one that properly accelerates Chrome with my eGPU  so try it and let us know.


For macOS(ONLY), run Chrome with "--force_discrete_gpu"  argument....
....(also try "--force_discrete_gpu=1" or "2")
If it doesn't work try  "--gpu-driver-bug-workarounds=48" or "228" 
If it doesn't work try  "--enable-features=force_discrete_gpu"

Post some feedback guys and good luck. 🙂
P.S. For Windows: NO LUCK...YET  😕

Thursday, April 9, 2020

mac apache php install (homebrew)


macOS 10.15 Catalina Apache Setup: Multiple PHP Versions

First part in a multi-part blog series for Mac developers

15 minutes
Part 1: macOS 10.15 Catalina Web Development Environment
Developing web applications on macOS is a real joy. There are plenty of options for setting up your development environments, including the ever-popular MAMP Pro that provides a nice UI on top of Apache, PHP and MySQL. However, there are times when MAMP Pro has slow downs, or out of date versions, or is simply behaving badly due to its restrictive system of configuration templates and non-standard builds.
It is times like these that people often look for an alternative approach, and luckily there is one, and it is relatively straight-forward to setup.
In this blog post, we will walk you through setting up and configuring Apache 2.4 and multiple PHP versions. In the second blog post in this two-post series, we will cover MySQL, Apache virtual hosts, APC caching, and Xdebug installation.
[Updated 12/02/2019] Updated to reflect the latest release of PHP 7.4 and the removal of PHP 7.1 from Official tap
[Updated 10/08/2019] Updated to reflect the release of macOS 10.15 Catalina
[Updated 01/10/2019] Updated to add back PHP 5.6 and PHP 7.0 from and external deprecated keg
[Updated 12/12/2018] Updated to reflect the latest release of PHP 7.3 and the removal of PHP 7.0 from Brew.
If you have followed this guide in the past with the Homebrew/php tap, and are looking to upgrade to the new Homebrew/core approach, then you should first clean-up your current installation by following our new Upgrading Homebrew.
This guide is intended for experienced web developers. If you are a beginner developer, you will be better served using MAMP or MAMP Pro.

XCode Command Line Tools

If you don't already have XCode installed, it's best to first install the command line tools as these will be used by homebrew:
$ xcode-select --install

Homebrew Installation

This process relies heavily on the macOS package manager called Homebrew. Using the brew command you can easily add powerful functionality to your mac, but first we have to install it. This is a simple process, but you need to launch your Terminal (/Applications/Utilities/Terminal) application and then enter:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Just follow the terminal prompts and enter your password where required. This may take a few minutes, but when complete, a quick way to ensure you have installed brew correctly, simply type:
$ brew --version
Homebrew 2.1.13
Homebrew/homebrew-core (git revision 99f8; last commit 2019-10-08)
You should probably also run the following command to ensure everything is configured correctly:
$ brew doctor
It will instruct you if you need to correct anything.

Catalina Required Libraries

When installing fresh on Catalina, I ran into a few libraries that were missing when completing all the steps below. To make things easier, please simply run these now:
$ brew install openldap libiconv

Apache Installation

The latest macOS 10.15 Catalina comes with Apache 2.4 pre-installed, however, it is no longer a simple task to use this version with Homebrew because Apple has removed some required scripts in this release. However, the solution is to install Apache 2.4 via Homebrew and then configure it to run on the standard ports (80/443).
If you already have the built-in Apache running, it will need to be shutdown first, and any auto-loading scripts removed. It really doesn't hurt to just run all these commands in order - even if it's a fresh installation:
$ sudo apachectl stop
$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
Now we need to install the new version provided by Brew:
$ brew install httpd
Without options, httpd won't need to be built from source, so it installs pretty quickly. Upon completion you should see a message like:
🍺  /usr/local/Cellar/httpd/2.4.41_1: 1,652 files, 27.7MB
Now we just need to configure things so that our new Apache server is auto-started
$ sudo brew services start httpd
You now have installed Homebrew's Apache, and configured it to auto-start with a privileged account. It should already be running, so you can try to reach your server in a browser by pointing it at http://localhost:8080, you should see a simple header that says "It works!".

Troubleshooting Tips

If you get a message that the browser can't connect to the server, first check to ensure the server is up.
$ ps -aef | grep httpd
You should see a few httpd processes if Apache is up and running.
Try to restart Apache with:
$ sudo apachectl -k restart
You can watch the Apache error log in a new Terminal tab/window during a restart to see if anything is invalid or causing a problem:
$ tail -f /usr/local/var/log/httpd/error_log
Apache is controlled via the apachectl command so some useful commands to use are:
$ sudo apachectl start
$ sudo apachectl stop
$ sudo apachectl -k restart
The -k will force a restart immediately rather than asking politely to restart when apache is good and ready

Visual Studio Code

In past guides, I've always provided instructions to edit files using the default TextEdit application that comes pre-installed. However, this is not what I use myself as it's a terrible editor and when testing my guide for Catalina, I kept running into problems with encoding, finding line numbers etc. The better solution is to simply install a better editor. So please install the amazingly versatile yet, 100% free, Visual Studio Code. It's available on Mac, Windows, and Linux, but right now we only care about the mac version.
Go to the Visual Studio Code site and click Download for Mac
Once downloaded, drag the application to your preffered Applications location. Next, you want to install the command line tools, so follow the official step-by-step instructions so that you can use the code command from the Terminal.

Apache Configuration

Now that we have a working web server, we will want to do is make some configuration changes so it works better as a local development server.
In the latest version of Brew, you have to manually set the listen port from the default of 8080 to 80, so we will need to edit Apache's configuration file.
/usr/local/etc/httpd/httpd.conf
If you followed the instructions above you should be able to use Visual Studio Code to edit your files using the code Terminal command. However, if you want to use the default TextEditor application to perform edits, you can use the open -e command followed by the path to the file.
$ code /usr/local/etc/httpd/httpd.conf
VSC
Find the line that says
Listen 8080
and change it to 80:
Listen 80
Next we'll configure it to use the to change the document root for Apache. This is the folder where Apache looks to serve file from. By default, the document root is configured as /usr/local/var/www. As this is a development machine, let's assume we want to change the document root to point to a folder in our own home directory.
Search for the term DocumentRoot, and you should see the following line:
DocumentRoot "/usr/local/var/www"
Change this to point to your user directory where your_user is the name of your user account:
DocumentRoot /Users/your_user/Sites
You also need to change the tag reference right below the DocumentRoot line. This should also be changed to point to your new document root also:
We removed the optional quotes around the directory paths as TextEdit will probably try to convert those to smart-quotes and that will result in a Syntax error when you try to restart Apache. Even if you edit around the quotes and leave them where they are, saving the document may result in their conversion and cause an error.
In that same block you will find an AllowOverride setting, this should be changed as follows:
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
Also we should now enable mod_rewrite which is commented out by default. Search for mod_rewrite.so and uncomment the line by removing the leading #:
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so

User & Group

Now we have the Apache configuration pointing to a Sites folder in our home directory. One problem still exists, however. By default, apache runs as the user daemon and group daemon. This will cause permission problems when trying to access files in our home directory. About a third of the way down the httpd.conf file there are two settings to set the User and Group Apache will run under. Change these to match your user account (replace your_user with your real username), with a group of staff:
User your_user
Group staff

Servername

Apache likes to have a server name in the configuration, but this is disabled by default, so search for:
#ServerName www.example.com:8080
and replace it with:
ServerName localhost

Sites Folder

Now, you need to create a Sites folder in the root of your home directory. You can do this in your terminal, or in Finder. In this new Sites folder create a simple index.html and put some dummy content in it like:

My User Web Root

.
$ mkdir ~/Sites
$ echo "

My User Web Root

"
> ~/Sites/index.html
Restart apache to ensure your configuration changes have taken effect:
$ sudo apachectl -k restart
If you receive an error upon restarting Apache, try removing the quotes around the DocumentRoot and Directory designations we set up earlier.
Pointing your browser to http://localhost should display your new message. If you have that working, we can move on!

PHP Installation

If you have existing PHP installations via Brew, you need to first cleanup your setup with our Upgrading Homebrew guide before continuing with this section.
Up until the end of March 2018, all PHP related brews were handled by Homebrew/php tab, but that has been deprecated, so now we use what's available in the Homebrew/core package. This should be a better maintained, but is a much less complete, set of packages.
PHP 5.6, PHP 7.0, and PHP 7.1 have been deprecated and removed from Brew because they are out of support, and while it's not recommended for production, there are legitimate reasons to test these unsupported versions in a development environment.
Remember only PHP 7.2 through 7.4 are officially supported by Brew so if you want to install PHP 5.6, PHP 7.0, or PHP 7.1 you will need to add this tap:
$ brew tap exolnet/homebrew-deprecated
We will proceed by installing various verions of PHP and using a simple script to switch between them as we need. Feel free to exclude any versions you don't want to install.
$ brew install php@5.6
$ brew install php@7.0
$ brew install php@7.1
$ brew install php@7.2
$ brew install php@7.3
$ brew install php@7.4
The first one will take a little bit of time as it has to install a bunch of brew dependencies. Subsequent PHP versions will install faster.
You no longer have to unlink each version between installing PHP versions as they are not linked by default
Also, you may have the need to tweak configuration settings of PHP to your needs. A common thing to change is the memory setting, or the date.timezone configuration. The php.ini files for each version of PHP are located in the following directories:
/usr/local/etc/php/5.6/php.ini
/usr/local/etc/php/7.0/php.ini
/usr/local/etc/php/7.1/php.ini
/usr/local/etc/php/7.2/php.ini
/usr/local/etc/php/7.3/php.ini
/usr/local/etc/php/7.4/php.ini
Let's switch back to the first PHP version now:
$ brew unlink php@7.4 && brew link --force --overwrite php@5.6
At this point, I strongly recommend closing ALL your terminal tabs and windows. This will mean opening a new terminal to continue with the next step. This is strongly recommended because some really strange path issues can arise with existing terminals (trust me, I have seen it!).
Quick test that we're in the correct version:
php -v

PHP 5.6.40 (cli) (built: Apr 23 2019 11:14:34) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Apache PHP Setup - Part 1

You have successfully installed your PHP versions, but we need to tell Apache to use them. You will again need to edit the /usr/local/etc/httpd/httpd.conf file scroll to the bottom of the LoadModule entries.
If you have been following this guide correctly, the last entry should be your mod_rewrite module:
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
Below this add the following libphp modules:
LoadModule php5_module /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so
#LoadModule php7_module /usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so
#LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so
#LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so
#LoadModule php7_module /usr/local/opt/php@7.3/lib/httpd/modules/libphp7.so
#LoadModule php7_module /usr/local/opt/php@7.4/lib/httpd/modules/libphp7.so
We can only have one module processing PHP at a time, so for now, so we have left our php@5.6 entry uncommented while all teh others are commented out. This will tell Apache to use PHP 5.6 to handle PHP requests. (We will add the ability to switch PHP versions later).
Also you must set the Directory Indexes for PHP explicitly, so search for this block:

    DirectoryIndex index.html
and replace it with this:

    DirectoryIndex index.php index.html



    SetHandler application/x-httpd-php
Save the file and stop Apache then start again, now that we have installed PHP:
$ sudo apachectl -k stop
$ sudo apachectl start

Validating PHP Installation

The best way to test if PHP is installed and running as expected is to make use of phpinfo(). This is not something you want to leave on a production machine, but it's invaluable in a development environment.
Simply create a file called info.php in your Sites/ folder you created earlier with this one-liner.
echo " > ~/Sites/info.php
Point your browser to http://localhost/info.php and you should see a shiny PHP information page:

If you see a similar phpinfo result, congratulations! You now have Apache and PHP running successfully. You can test the other PHP versions by commenting the LoadModule ... php@5.6 ... entry and uncommenting one of the other ones. Then simply restart apache and reload the same page.

PHP Switcher Script

We hard-coded Apache to use PHP 5.6, but we really want to be able to switch between versions. Luckily, some industrious individuals have already done the hard work for us and written a very handy little PHP switcher script.
We will install the sphp script into brew's standard /usr/local/bin:
$ curl -L https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw > /usr/local/bin/sphp
$ chmod +x /usr/local/bin/sphp

Check Your Path

Homebrew should have added its preferred /usr/local/bin and /usr/local/sbin to your path as part of its installation process. Quickly test this by typing:
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin
If you don't see this, you might need to add these manually to your path. Depending on your shell your using, you may need to add this line to ~/.profile, ~/.bash_profile, or ~/.zshrc. We will assume you are using the default bash shell, so add this line to a your .profile (create it if it doesn't exist) file at the root of your user directory:
export PATH=/usr/local/bin:/usr/local/sbin:$PATH

Testing the PHP Switching

After you have completed these steps, you should be able to switch your PHP version by using the command sphp followed by a two digit value for the PHP version:
$ sphp 7.1
You will probably have to enter your administrator password, and it should give you some feedback:
Switching to php@7.1
Switching your shell
Unlinking /usr/local/Cellar/php@5.6/5.6.40... 319 symlinks removed
Unlinking /usr/local/Cellar/php@7.1/7.1.33... 0 symlinks removed
Unlinking /usr/local/Cellar/php@7.2/7.2.25... 0 symlinks removed
Unlinking /usr/local/Cellar/php@7.3/7.3.12... 0 symlinks removed
Unlinking /usr/local/Cellar/php/7.4.0... 0 symlinks removed
Linking /usr/local/Cellar/php@7.1/7.1.33... 25 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/php@7.1/sbin:$PATH"' >> ~/.zshrc
You will need sudo power from now on
Switching your apache conf
Restarting apache

PHP 7.1.33 (cli) (built: Nov 28 2019 14:00:51) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies

All done!
Test to see if your Apache is now running PHP 7.1 by again pointing your browser to http://localhost/info.php. With a little luck, you should see something like this:

Upgrading your system to PHP 7.4

If you have already installed this setup prior to December 2019, where PHP 7.3 was the latest, you can easily update your setup to support the new PHP 7.4 version with a few steps:
  1. Update to latest PHP 7.4 with brew update && brew upgrade
  2. This will upgrade the default php package from 7.3 to 7.4. You then need to re-install PHP 7.3 with: brew install php@7.3
  3. Update the PHP switcher script (sphp) with the latest version that adds support for PHP 7.4 by re-running the commands:
    $ curl -L https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw > /usr/local/bin/sphp
    $ chmod +x /usr/local/bin/sphp
That's it, just sphp 7.4 to Switch to PHP 7.4 and you should be good to go!

Updating PHP and other Brew Packages

Brew makes it super easy to update PHP and the other packages you install. The first step is to update Brew so that it gets a list of available updates:
$ brew update
This will spit out a list of available updates, and any deleted formulas. To upgrade the packages simply type:
$ brew upgrade
You will need to switch to each of your installed PHP versions and run update again to get updates for each PHP version and ensure you are running the version of PHP you intend.

Activating Specific/Latest PHP Versions

Due to the way our PHP linking is set up, only one version of PHP is linked at a time, only the current active version of PHP will be updated to the latest version. You can see the current active version by typing:
$ php -v
And you can see the specific versions of a PHP package by typing:
$ brew info php@7.1
exolnet/deprecated/php@7.1: stable 7.1.33 (bottled) [keg-only]
General-purpose scripting language
https://www.php.net/
/usr/local/Cellar/php@7.1/7.1.33 (509 files, 62.8MB) *
  Poured from bottle on 2019-12-02 at 09:53:53
From: https://github.com/exolnet/homebrew-deprecated/blob/master/Formula/php@7.1.rb
==> Dependencies
Build: httpd ✔, pkg-config ✔
Required: apr ✔, apr-util ✔, aspell ✔, autoconf ✔, curl-openssl ✔, freetds ✔, freetype ✔, gettext ✔, glib ✔, gmp ✔, icu4c ✔, jpeg ✔, libpng ✔, libpq ✔, libtool ✔, libzip ✔, mcrypt ✔, openldap ✔, openssl@1.1 ✔, sqlite ✔, tidy-html5 ✔, unixodbc ✔, webp ✔
...

OK, that wraps up Part 1 of this 3 part series You now have a fully functional Apache 2.4 installation with a quick-and-easy way to toggle between PHP 5.6, 7.0, 7.1, 7.2, 7.3 and 7.4. Check out Part 2 to find out how to setup your environment with MySQL, Virtual Hosts, APC caching, YAML, and Xdebug. Also take a gander at Part 3 to find out how to setup SSL for your Apache Virtual Hosts.


Monday, April 6, 2020

mac node mysql apache





cd /usr/local/var/www/json2tree










cd /Users/nicole/node/arcgis_viewer

nodemon --exec npm start








cd /Users/nicole/node/world





mac show hidden file
    CMD + SHIFT + .
 or terminal run:
 defaults write com.apple.finder AppleShowAllFiles YES
https://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/








mac exit full screen
    cmd + ctrl + f

















---------------

mac visual studio code, show tabs
you need edit setting.json file, and change from false to true

settings.json, located at

    Windows %APPDATA%\Code\User\settings.json
    macOS $HOME/Library/Application Support/Code/User/settings.json
    Linux $HOME/.config/Code/User/settings.json


{
    "workbench.editor.showTabs": true
}
---------------











*********  mac install nodemon *************



  // terminal, must use root , otherwise, failed install nodemon Global

    sudo -s



  // Must install Global

  sudo npm i -g nodemon




//local install will failed to start later
//Do not use:   npm install --save-dev nodemon



nodemon --exec npm start

*********  mac install nodemon *************











=================== bookmark =======================

cpanel
https://104.238.125.233:2083/cpsess6948351829/frontend/paper_lantern/index.html?login=1&post_login=48187625039743


WHM
https://104.238.125.233:2087/cpsess8149350323/?login=1&post_login=43362710941285



goDaddy, product
https://myservers.godaddy.com/208989







................. install mysql on mac with Homebrew .......................

Using Homebrew service to download

Homebrew is a package manager for Mac which greatly simplifies the process of installing command line software and tools on a Mac. It’s one of the most common ways to install an app on Mac.

To install Homebrew, open Terminal and run:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Note: Homebrew will download and install Command Line Tools for Xcode as part of the installation process. This might take a lot of time since those apps are not lightweight.

Then install MySQL using Homebrew:

$ brew install mysql
Install brew services:

$ brew tap homebrew/services

Load and start the MySQL service:

$ brew services start mysql

Expected output: Successfully started mysql (label: homebrew.mxcl.mysql)

Open Terminal and execute the following command to set the root password:

mysqladmin -u root password 'yourpassword'
Now your MySQL server is ready.

              


        **** DO NOT FORGET ****
        
        reset root password:   4a41
        
        in order for node.js connect to mysql, must run following sql at sql-workbench
        
        ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '4a41'


          without run this sql, will get error, when node.js connect mysql client.
          
          Client does not support authentication protocol requested by server; consider upgrading MySQL client


................. install mysql on mac with Homebrew .......................





------------------- install NodeJS and NPM on Mac using Homebrew -------------------

https://medium.com/@hayasnc/how-to-install-nodejs-and-npm-on-mac-using-homebrew-b33780287d8f


Step 1: Install Homebrew

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"



Step 2: Install Node via Homebrew
$ brew install node



   check node and npm version

$node -v
v12.7.0

$npm -v
6.10.0

------------------- install NodeJS and NPM on Mac using Homebrew -------------------
















****************** ******************* **********************

Installing Git on a Mac
Open a terminal window.

Step 1 – Install Homebrew
Homebrew […] simplifies the installation of software on the Mac OS X operating system.

– Homebrew – Wikipedia

Copy & paste the following into the terminal window and hit Return.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
You will be offered to install the Command Line Developer Tools from Apple. Confirm by clicking Install. After the installation finished, continue installing Homebrew by hitting Return again.

Step 2 – Install Git
Copy & paste the following into the terminal window and hit Return.

brew install git
You can use Git now.
****************** ******************* **********************

Thursday, April 2, 2020

centOS SSL 2022


Note: must have private.key and public.cer file, missing any one will cause error when npm start









2022 comodo SSL 


1). on comodo, need  Input CSR (Certificate Signing Request)

     cpanel > SSL / TLS > click  SSL certificate signing request

      fill out:  

Generate a New Certificate Signing Request (CSR)


      key:  choose generate a new key
      domains:   type "transparentgov.net"



click "generate" button at bottom


copy CSR
                      -----BEGIN CERTIFICATE REQUEST-----
                      -----END CERTIFICATE REQUEST-----







2). on comodo,  select your server

                     apache-modSSL






4) select approver email

                  admin@transparentgov.net


5) check email,  admin@transparentgov.net

             copy validation code
 
             click 'validation' link,



6) click re-check status, button

          download certificate






7)  cpanel > SSL / TLS >CERTIFICATES (CRT)
 Generate, view, upload, or delete SSL certificates

Upload a New Certificate
or just copy past here

   Now a new certificate save on server. next step, install it.



8)  cpanel > SSL / TLS > INSTALL AND MANAGE SSL FOR YOUR SITE (HTTPS)
 Manage SSL sites.

      browse to the newly saved certificate

      click "install"  button

Done. apache. 

  next step do 2 node.js apps.

9) warning: if  arcgis_viewer node.js crash on localhost
that means, private key and public certificate does not match.
I must go to cpanel, SSL check both private key and certificate.

When I renew or install a new certificate, maybe a new private key was generated as well. I must copy paste that private key into node.js app. 

10) arcgis_viewer,  bin folder,  public.cert is from email downloaded 
private key is from cpanel,  > 

CERTIFICATES (CRT)

click 'edit' for the new installed certificate expire in next year.

now scroll down to bottom,  click  that private key

This certificate uses the following key:


This is the private key, I must copy past in node.js Bin folder, private.key file.

----------------------------------------------------------------------------







https://huguowen.blogspot.com/2018/07/centos-ssl.html



centOS putty log in:

      arcgis_viewer:
                                                           
                                    **** Do NOT use sudo su - hoogw2000, use hoogw for 'node' folder, if use hoogw2000, node will not run or run error.
                                    cd /home/hoogw2000/node/arcgis_viewer/



                                    *******  must sudo su, access folder public_html, without this will access deny, node should not in public_html folder, because should hide private.key from public access
                                    sudo su - hoogw2000
                                    cd /home/hoogw2000/public_html/arcgis_viewer/



                                    Must rename .env to windows.env and centos.env to .env

                                    pm2 start npm -- start




      cors-anywhere:
                       

                            **** Do NOT use sudo su - hoogw2000, use hoogw for 'node' folder, if use hoogw2000, node will not run or run error.
                            cd /home/hoogw2000/node/cors-anywhere/


                            *******  must sudo su, access folder public_html, without this will access deny, node should not in public_html folder, because should hide private.key from public access
                            sudo su - hoogw2000
                            cd /home/hoogw2000/public_html/cors-anywhere/

                            pm2 start server.js









++++++++++++ re-key +++++++++++++++++

first skip re-key
if SSL does't work, or change domain, or change server,  always should re-key

     --------------- re-key -------------------

     ON godaddy

            my product ------------ SSL certificate ----- click manage button


            you should see your ssl certificate, click it.

            Re-Key

            Top menu, click repository,

            3 big button, download, re-key,  xxx.  click re-key

            3 plus + sign, click first +,  past your CSR here. ( how to get CSR? ---- go to cpanel, search SSL,  click Certificate Signing Requests (CSR) )

             copy the Encoded Certificate Signing Request, and past on goDaddy re-key page, then submit.
            REMEMBER:
                everytime you creat a new Certificate Signing Request, you auto create a new private key saved at Private Keys (KEY) page
                you will use this as private.key file later


             wait a few minutes

             you get email from godaddy(certificate authority)



      Download crt, choose apache only. for both apache and node.js
      (if you choose 'other' for node and 'apache' for centOS, the node.js app will not work)

      !!! must use same certificate for both apache and node. !!!!!!!!




+++++ node.js   +++++


    1 . public key:
    copy c1b82dd3af7660ec.crt from cpanel or downloaded.zip to node.js , (do NOT use gd_bundle-g2-g1.crt)
    rename c1b82dd3af7660ec.crt to  public.cert   at  /bin/www/public.cert


    2 . private key: (if renew, still use old private key, no change here)
    you should download from godaddy product page, click SSL certificate, download private key.
    rename generated-private-key.txt to private.key (optional, whatever name you like,you will use same name in WWW file)




 ++++++++ centOS SSL apache    +++++++++++

     godaddy cpanel  --------- click SSL/TLS


1) click Private Keys (KEY), delete old private key, upload a new private key.(renew, private key, no change skip this )



2) click Certificate Signing Requests (CSR)
   skip this, since godaddy already put certificate crt file on download zip.
   If you want to re-key, you do want send Certificate Signing Requests (CSR)
   and wait until get crt file



3) click Certificates (CRT), this is where you need upload your crt(certificate) file to centOS apache server.
   click to Upload a New Certificate, choose the 6e1dce9c9beeeed6.crt file(publick.cert) you downloaded from godaddy.
   you may want to choose apache version one.

   Once upload,you should see a new certificate saved on server.




4) click Install and Manage SSL for your site (HTTPS)
     I. uninstall all old certificate (see expiratin date)

     II. click browse certificates, choose the one you saved on last step certificate(CRT)
         click install certificate



5) Do not forget  re-upload node.js (with new certificate), arcgis_viewer and cors-anywhere



********* only renew ***********

1) download certificate zip file from godaddy,
     only 6e1dce9c9beeeed6.crt is we need.

2) upload crt file to cpanel.  cpanel -- ssl , click certificate(CRT)

      upload a new certificate, click choose file, choose xxx.crt(just downloaded).

3) install new crt, by click install.


---------------------------



******************** full steps ***********************

godaddy SSL

ON Server

1) cpanel  --------- click SSL/TLS

2) click
Certificate Signing Requests (CSR)

    click Generate


3) copy first part:  encoded CSR



ON godaddy

my product ------------ SSL certificate ----- click manage button


you should see your ssl certificate, click it.

Re-Key

Top menu, click repository,

3 big button, download, re-key,  xxx.  click re-key

3 plus + sign, click first +,  past your CSR here.


Click Save button

at bottom, click "generate certificate" button.


Wait ..................  hours? days?.........................


You got a email from godaddy,  follow download link to download zip file.

zip file has 2 crt file.


Upload 2 crt file at cpanel.  click SSL/STL

click
Certificates (CRT)

Upload a New Certificate


choose file, 2 crt.

then you upload crt.



at SSL/STL   click
Manage Installed SSL Websites

click

Browse certificate, choose the new one you just uploaded.

then install.

Done





****** check certificate ******

https://ssltools.godaddy.com/views/certChecker








node express add SSL



1)
download private key file from cpanel ----- ssl/STL ---- private key---
click edit, copy encoded part into a new file. Save to /bin/www/private.key

2)
download certificate file, from godaddy, my product, SSL,
click download button, choose other type.

Only 1 file xxxx.crt is the one we need, copy to  /bin/www/public.cert

 you can copy past encoded certificate from cpanel---ssl , click Certificate(CRT),   click edit,
copy encoded certificate


3)
/bin/www  file add https code.

// readFileSync function must use __dirname get current directory


// require use ./ refer to current directory.















Sunday, March 29, 2020

egpu


https://github.com/mayankk2308/purge-wrangler/wiki/Beginner's-Guide

1) disable SIP by restart and hold command + R until see apple logo

     in recovery mode, utility > terminal 
     run : csrutil disable


      restart



2)navi card, must manually do AMD patch

https://github.com/mayankk2308/purge-wrangler/issues/44

   open terminal run: 
 
curl -qLs $(curl -qLs https://bit.ly/2WtIESm | grep '"browser_download_url":' | cut -d'"' -f4) > purge-wrangler.sh; sh purge-wrangler.sh; rm purge-wrangler.sh

choose "Setup eGPU" by pressing 1

   For Nvidia card, you have have Nvida web driver already installed, otherwise, not find epu 

   For AMD, native supported card, power on egpu, will auto detect.

    For AMD navi card, do not power on egpu, if you power on, Mac will crash to white error screen and reboot and crash loop.

     Instead you should press ESC to cancel auto detect 

      then press 1. AMD (vendor) to manually patch 


      restart


3) Enforce both external and Internal display use egpu by set-ogpu
 https://github.com/mayankk2308/set-egpu

    terminal run:
curl -q -s "https://api.github.com/repos/mayankk2308/set-egpu/releases/latest" | grep '"browser_download_url":' | sed -E 's/.*"browser_download_url":[ \t]*"([^"]+)".*/\1/' | xargs curl -L -s -0 > set-eGPU.sh && chmod +x set-eGPU.sh && ./set-eGPU.sh && rm set-eGPU.sh

future use, just
set-eGPU

choose 1. all application

will enforce all application include internal display use egpu

Done

Friday, February 28, 2020

centOS CORS on Apache


cpanel, top right corner, click setting, make sure show hidden files.


go to The folder you wish CORS, in our case, it is /data/ 

add .htaccess file

add one line at   .htaccess  file.

done
 Header set Access-Control-Allow-Origin "*"

Monday, January 6, 2020

adsense



/includes/qa-theme-base.php
1 file, 2 place need add adsense, 


header_script add adsense for home page, 
public function head_script()
    {
        if (isset($this->content['script'])) {
            foreach ($this->content['script'] as $scriptline) {
                $this->output_raw($scriptline);
            }
        }



/* header
google adsense added
*/
        $this->output('');



    }




Do not need this one, if add this one, every post will have error duplicate tag, second tag will be ignored.

this is for each post add adsense




public function q_view_main($q_view)
    {
        $this->output('
'
);

        if (isset($q_view['main_form_tags'])) {
            $this->output('
. $q_view['main_form_tags'] . '>'); // form for buttons on question
        }

        $this->view_count($q_view);
        $this->q_view_content($q_view);


/**
google adsense added
*/
        $this->output('');


        $this->q_view_extra($q_view);






https://www.question2answer.org/qa/14080/where-to-insert-custom-html-code-adsense-etc


Ok. I got it. Open includes/qa-theme-base.php and go down find see code under function q_view_main($q_view) on or around line # 1672. I wanted to put the adsense banner direcly below the question text/content and before the tags. So I inserted a new line $this->output('my adsense code
');
 right under the line that says $this->q_view_content($q_view);   . It worked great. Now I'll probably go about learning how to implement this using advanced themes by creating a custom q_view_main($q_view) function to override the default code. Any tips/example for newbies for creating function overrides would be appreciated from more experienced users. Thanks.