Monday, April 8, 2019

AEM build core java classes and install bundle command

mvn install -PautoInstallBundle -Padobe-public

Wednesday, March 13, 2019

AEM build a maven based project

mvn -PautoInstallPackage -Padobe-public clean install

Note: Adding -Padobe-public parameter in order to install dependencies found in Adobe repositories
If these repositories are found in the corporate local artifactory, then no need to add this parameter

Tuesday, March 12, 2019

Webpack config changes to avoid random chunks names


In React-scripts created project, extract the webpack.config.js via running "react-script eject"

Update react.config.js:
- Find new MiniCssExtractPlugin(..) and delete "[contenthash:8]"
- Find output.filename and output.chunkFilename and delete "[contenthash:8]"
- Set optimization.runtimeChunk to false to avoid inline JavaScript inside index.html

Monday, March 11, 2019

Webpack App dev server proxy configuration

{
  "name": "app-name",
  "version": "0.1.0",
  "private": true,
  "homepage": "https://mywebsite.com/path/to/the/app",
  "dependencies": {
    "axios": "^0.18.0",
    "prop-types": "^15.6.1",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-ga": "^2.4.1",
    "react-scripts": "1.1.1",
    "react-transition-group": "^1.2.1"
  },
  "scripts": {
    "start-js": "react-scripts start",
    "start": "npm-run-all -p watch-css start-js",
    "build": "npm run build-css & react-scripts build && rm -rf docs && mv build output",
    "build-css": "node-sass-chokidar src/ -o src/",
    "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recusive",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "serve": "webpack-dev-server --open"
  },
  "devDependencies": {
    "node-sass-chokidar": "^1.2.0",
    "npm-run-all": "^4.1.2"
  },
  "proxy": {
    "/path/to/my/apis": {
      "target": "https://apis.mydomain.com",
      "secure": false,
      "headers": {
        "host": "apis.mydomain.com",
        "Accept": "application/json"
      }
    }
  }
}

Monday, October 15, 2018

JCR folder

Java Console Repository

Monday, March 19, 2018

Signing Android APK in command line

In Windows OS:

\Users\{{user_name}}\AppData\Local\Android\sdk\build-tools\{{sdk-version}}\apksigner sign -ks \path\to\my.keystore --out signed.apk unsigned.apk

Android SDK apksigner in build tools

apksigner.bat is found at the path:
$ANDROID_HOME/build-tools/$SDK/$SDK_VERSION

@Linux: cd $ANDROID_HOME/build-tools/$SDK
@MS DOS: cd %ANDROID_HOME%\build-tools

choose the sdk version folder

Monday, January 22, 2018

Use Git password cache on Windows


Run the command:
git config credential.helper store

Run same command if password has expired

Tuesday, June 13, 2017

List android debug.keystore keys

On Windows:
keytool -list -v -keystore %USERPROFILE%\.android\debug.keystore

default password is "android"

Thursday, May 4, 2017

Install Chocolatey (choco) on Windows

On administrator command line prompt run the following command:

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"


From PowerShell:

Set-ExecutionPolicy Bypass
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))


To upgrade Chocholatey:
choco upgrade chocolatey

Friday, January 27, 2017

Excel convert YYYYWW to date


=DATE(LEFT(A1,4), 1, -2) - WEEKDAY(DATE(LEFT(A1,4), 1, 3)) + RIGHT(A1,2) * 7

Sunday, January 1, 2017

Converting SQL text columns from a single byte character codes to UTF8

use my_database;
-- preserve your old data in blob type
alter table my_tabe change my_column my_column blob;
-- set your default encoding to utf8
alter table my_table convert to character set utf8;
-- tell sql server your old code page ( i.e.: cp1256 )
alter table my_table change my_column my_column text charset {{code page}};

Convert Non-UTF8 tables to UTF8 in sql database

-- convert old text columns to blob,
ALTER TABLE my_table CHANGE my_column_name my_column_name BLOB;
-- then update table character set
ALTER ignore TABLE my_table CONVERT TO CHARACTER SET utf8;
-- then convert the text columns back to text type
ALTER TABLE my_table CHANGE my_column_name my_column_name TEXT;

-- If your old scripts break, try explicitly setting the names to UTF8 before making sql queries
SET NAMES utf8;
SELECT my_column_name FROM my_table limit 10;

Sunday, May 15, 2016

Enable an apache2 module


cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/rewrite.load rewrite.load
sudo service apache2 restart

My webserver installation notes


$ sudo apt-get install build-essential
$ sudo apt-get install openssh-server
$ sudo apt-get install mysql-server
$ sudo apt-get install apache2
$ sudo apt-get install php5
$ sudo apt-get -y install imagemagick
$ sudo apt-get install perlmagick
$ sudo apt-get install libexpat1-dev
$ sudo apt-get install libapache2-mod-perl2
$ sudo apt-get install libapache2-mod-php5
$ sudo apt-get install php5-mysql
$ sudo apt-get install libdbd-mysql-perl
$ sudo apt-get install Sendmail
$ perl -MCPAN -e "install JSON"
$ perl -MCPAN -e "install XML::Parser"
$ perl -MCPAN -e "install XML::Simple"
$ perl -MCPAN -e "install IP::Country"
$ perl -MCPAN -e "install CGI"
$ perl -MCPAN -e "install CGI::Session"
$ perl -MCPAN -e "install DBI"
$ perl -MCPAN

$ cd /etc/apache2/mods-enabled
$ sudo ln -s ../mods-available/rewrite.load rewrite.load
$ sudo ln -s ../mods-available/expire.load expire.load
$ sudo ln -s ../mods-available/perl.load perl.load

Edit php.ini and set short_tag to true

Configure apache to run .pl scripts as CGI

Add mod_perl handler ( Include website cgi-bin to the included library folders in a preloaded perl script)

AddHandler cgi-script .pl

For mod_rewrite and make sure AllowOverride is enabled in your web directory

add linux users to www-data group via the command:
usermod -a -G username

Add & ~E_NOTICE to apache2 php.ini report_errors

use Mail::Sendmail; #instead of use Sendmail;

$dbh->do(q{set sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'}); # to avoid ONLY_FULL_GROUP_BY

Thursday, February 11, 2016

Find hacker patterns

find -name "*.php"
grep . -nrlw --exclude=*.{php,jpg} -e 'eval'
grep . -nrlw --exclude=*.{js,htm,html,jpg} -e '_REQUEST'
grep . -nrlw --exclude=*.{js,htm,html,jpg} -e 'uuid'
grep . -nrlw --exclude=*.{js,htm,html,jpg} -e '$log_email'

Wednesday, February 3, 2016

Configure SVN external editor on Windows


Find and edit the file \users\\AppData\Roaming\Subversion\config
Find the line containing editor-cmd = 
Set your editor command

Tuesday, January 5, 2016

Finding the Windows process that is holding a TCP port


netstat -ano | grep {port_number}

You can then read the process id from the report.

Tuesday, December 22, 2015

Find a linux command


Use the following utility "apropos"

To find any command ( or command description ) that contains "time" substring.
#apropos time