Posts

Showing posts from June, 2020

Digital Marketing

Setting Context-Root with Glassfish

asadmin deploy --name something --contextroot /your-app-path /path/of/your/war.war

Maven lifecycle phases

Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.

Setting the Default Java Version

You might have 2 different versions of Java on your system. To set one as the default , use the command: sudo alternatives ––config java The system displays a list of different Java versions. If you like the default, press Enter. If you want to change it, type the number of the version you want, then press Enter.

How to reload Apache

sudo service httpd reload OR sudo systemctl reload httpd

Get Linux IP by hostname

$ hostname -I 172.17.0.2

Bash prompt variables

We can customize bash prompt by changing the values of bash PS1, PS2, PS3, PS4. root@2e5540791177:/# echo "Bash PS1 variable:"  $PS1 Bash PS1 variable: \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ root@2e5540791177:/# echo "Bash PS2 variable:"  $PS2 Bash PS2 variable: > root@2e5540791177:/# PS1="\u@\H:\w [\t]\$ " root@2e5540791177:/ [23:52:00]$

Invoked Bash as an interactive non-login shell

When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the  --norc  option. The --rcfile file option will force Bash to read and execute commands from file instead of ~/.bashrc. So, typically, your ~/.bash_profile contains the line if [ -f ~/.bashrc ]; then . ~/.bashrc; fi after (or before) any login-specific initializations.

Record Linux terminal session

script makes a typescript of everything printed on your terminal. If the argument file is given, script saves all dialogue in the indicated file in the current directory. If no file name is given, the typescript is saved in default file typescript.  root@2e5540791177:/# script output.log Script started, file is output.log # date Sat Jun 27 23:44:48 UTC 2020 # exit Script done, file is output.log root@2e5540791177:/# root@2e5540791177:/# script Script started, file is typescript # ls bin  boot  dev  etc  home  lib  lib32  lib64  libx32  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  typescript  usr  var # date Sat Jun 27 23:43:23 UTC 2020 # exit Script done, file is typescript root@2e5540791177:/# cat typescript Script started on 2020-06-27 23:43:14+00:00 [TERM="xterm" TTY="/dev/pts/0" COLUMNS="172" LINES="55"] # ls bin  boot  dev  etc  home  lib...

How To Change Timezone on Linux

[ec2-user@ip-172-16-0-86 ~]$ date Wed Jun 24 12:52:22 UTC 2020 [ec2-user@ip-172-16-0-86 ~]$ timedatectl list-timezones | grep Toronto America/Toronto [ec2-user@ip-172-16-0-86 ~]$ sudo timedatectl set-timezone America/Toronto [ec2-user@ip-172-16-0-86 ~]$ date Wed Jun 24 08:54:18 EDT 2020

IPython -- An enhanced Interactive Python

IPython offers a fully compatible replacement for the standard Python interpreter, with convenient shell features, special commands, command history mechanism and output results caching. At your system command line, type 'ipython -h' to see the command line options available.

Remove Symbolic Links with rm

To get prompted before removing the symlink, use the -i option: rm -i symlink_name If the symbolic link points to a directory, do not append the / trailing slash at the end. Otherwise, you will get an error: rm symlink_to_dir/ rm: cannot remove 'symlink_to_dir/': Is a directory To be on the safe side, never -r option when removing symbolic links with rm. 

Apple Watches are the best and the most advanced smartwatches available right now.

Make online money from the Internet

Make online money from the Internet   Create your own YouTube channel and become a YouTube partner to monetize your videos. You may use  Oneload  to distribute the same video to multiple video sites. Make something creative – like handbags, jewelry, paintings, craft items – and sell them on  Etsy ,  ArtFire  or eBay. Build your own online store with  Shopify  or  SquareSpace  and sell both physical goods and digital downloads. Sell everything from furniture to clothes to food. Create t-shirt designs and put them on  Threadless ,  Zazzle  and  CafePress . Write a book and publish it on the Kindle store, Google Play and iBooks. You can also sell your ebook to other retailers through services like  Smashwoods  and  BookBaby . Become an instructor at  SkillShare  and get paid for teaching your favorite subjects – from guitar to literature to yoga to foreign languages – to...

Code Tools: jmh - OpenJDK: jmh

JMH is a Java harness for building, running, and analysing nano/micro/milli/macro benchmarks written in Java and other languages targetting the JVM. https://openjdk.java.net/projects/code-tools/jmh

A prime number is a natural number greater than whose only positive divisors are and itself.

 For example, the first six prime numbers are , , , , , and .

Faban comes with a simple program (fhb) that can be used to measure the performance of a simple URL

a free and open source performance workload creation and execution framework. Faban is used in performance, scalability and load testing of almost any type of server application. If the application accepts requests on a network, Faban can measure it. Read more...

China finds heavy coronavirus traces in seafood, meat sections of Beijing food market

Get processlist of MySQL

For non-sleep processlist: $ mysql --login-path=root -e "SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST pl where pl.command not in ('Sleep')\G "  | less For all processlist: SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST SHOW FULL PROCESSLIST

Official Jenkins Docker image

To use the latest LTS: docker pull jenkins/jenkins:lts To use the latest weekly: docker pull jenkins/jenkins https://hub.docker.com/r/jenkins/jenkins

Update default python on Linux

Add alias python=python3 to /etc/profile Then source /etc/profile

To search using Vim/vi

In normal mode, you can search forward or backward. One can search forward in vim/vi by pressing / and then typing your search pattern/word. To search backward in vi/vim by pressing ? and then typing your search pattern/word. Once a word found in vim, you can press the n key to go directly to the next occurrence of the word backwards.

Java JVM time zone

The list of supported Java JVM time zone IDs is: Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers Africa/Asmara Africa/Asmera Africa/Bamako Africa/Bangui Africa/Banjul Africa/Bissau Africa/Blantyre Africa/Brazzaville Africa/Bujumbura Africa/Cairo Africa/Casablanca Africa/Ceuta Africa/Conakry Africa/Dakar Africa/Dar_es_Salaam Africa/Djibouti Africa/Douala Africa/El_Aaiun Africa/Freetown Africa/Gaborone Africa/Harare Africa/Johannesburg Africa/Juba Africa/Kampala Africa/Khartoum Africa/Kigali Africa/Kinshasa Africa/Lagos Africa/Libreville Africa/Lome Africa/Luanda Africa/Lubumbashi Africa/Lusaka Africa/Malabo Africa/Maputo Africa/Maseru Africa/Mbabane Africa/Mogadishu Africa/Monrovia Africa/Nairobi Africa/Ndjamena Africa/Niamey Africa/Nouakchott Africa/Ouagadougou Africa/Porto-Novo Africa/Sao_Tome Africa/Timbuktu Africa/Tripoli Africa/Tunis Africa/Windhoek America/Adak America/Anchorage America/Anguilla America/Antigua America/Araguaina America/Argentina/Buenos_Aires America...

jq is a lightweight and flexible command-line JSON processor.

jq is like sed for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text. https://stedolan.github.io/jq/

How to activate SSL/HTTPS on Jenkins

For CentOS or RPM based: Go to /etc/sysconfig/jenkins, set the JENKINS_HTTP S _PORT="8443" Then restart Jenkins. If you want to generate ssh key: openssl genrsa -out key.pem  # creates key.pem openssl req -new -key key.pem -out csr.pem # you need to put the dns name of your website, testweb.local # for the 'Common Name' question # other questions, you can just accept defaults # actually, you can accept defaults for all, will work ok too openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem rm csr.pem start jenkins if you want both https and http: java -jar jenkins.war --httpsPort=8443 --httpsCertificate=cert.pem --httpsPrivateKey=key.pem if you want https only, dont open http port: java -jar jenkins.war --httpsPort=8443 --httpsCertificate=cert.pem --httpsPrivateKey=key.pem --httpPort=-1 starting a slave Convert the cert.pem to cert.der:  openssl x509 -outform der -in cert.pem -out cert.der create keystore, containing this cert: keytool -import -alia...

Fixed jenkins Failed to connect to repository : Error performing git command: git ls-remote -h git@

You need to git is available in your system git path is correctly set in the Jenkins Verify your git path at: Jenkins > Manage Jenkins > Global Tool Configuration > Git