Posts

How to install MySQL in docker

Step 1: Pull mysql image MySQL can be of any version, but I chose 5.6 for setup $ sudo docker pull mysql/mysql-server:5.6 To pull the latest version $ sudo docker pull mysql/mysql-server Step 2: Start and config MySQL Copy IMAGE_ID $ sudo docker images To create and run MySQL first time $ sudo docker run --name mysql-5.6 -p 52000:3306 -e MYSQL_ROOT_PASSWORD=yourpassword -d IMAGE_ID Description --name => container name (can be anything) -p  => external port : internal port -e  => Environment variables (MYSQL_ROOT_PASSWORD) -d   => Detached mode Step 3: Check the mysql process status $ sudo docker ps To enter the MySQL server $ sudo docker exec -it CONTAINER_ID bash $ mysql -uroot -pyourpassword  After initial container creation to run MySQL copy the CONTAINER_ID $ sudo docker container ls -a To start $ sudo docker start CONTAINER_ID To connect using external MySQL first grant privileges $ mysql -P52000 -uroot -ppassword

How to earn BAT by watching ads

Image
Earn BAT tokens for watching ads Basic Attention Token (BAT) is awarded for watching ads in Brave browser. The ads you watch are stored in the browser local storage thus maintaining privacy of users. In case of Facebook / Google ads watched by the user is send to a central server where it is stored and used for future profiling. It exchanges token for attention, thus the name. Step 1: Download & Install the B rave browser. Step 2: Enable Ads Click on the address bar triangle icon.   Click Reward settings. Enable Rewards  

How to mine cryptocurrency using unMineable

Image
  Things needed to mine Miner Miner is a software which use your computers resource to solve mathematical puzzles. For solving the puzzles/problem you will be rewarded with tokens. Wallet Wallet is similar to physical wallet used to store the mined token. Mining pool (unMineable) Pool is nothing but sharing of resources(processing power) with other miners and split the rewarded token based on the contribution. Step 1 : Go to unmineable website Step 2 : Select a cryptocurrency of your choice. (Eg. Bitcoin BTC) Step 3 : Select any of the mining algorithm based on your equipment. Ethash  Requirement : Powerful GPU with Min 6 GB VRAM Etchash  Requirement :  Powerful GPU with Min 3 GB VRAM RandomX If you don't have GPU and you would like to mine using CPU randomX is your choice. KawPow  Requirement :  Powerful GPU with Min 3 GB VRAM Step 3a: To check for profitability find the megahash/s(mh/s). To find mh/s Google Graphics card name mh. (nvidia 1060 mh) Enter the mh in profitability

Send photo to email when entering wrong password

Step 1 : Prerequisites installation (Optional if available) ffmpeg (Photo app) s-nail  (Mail app) For more ways to take picture refer this article . $ sudo apt update $ sudo apt install ffmpeg s-nail Step 2 : Create App password from google account Check this to create app passwords. Step 3 : Change the email and password(App password) in the script Create file sudo nano /usr/local/bin/takepic filename=`date +%s` ffmpeg -f video4linux2 -s vga -i /dev/video0 -vframes 1 /tmp/$filename.jpg echo ' ALERT Usage detected:'  `date` `who` | s-nail -a /tmp/$filename -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth=login -S smtp=smtp://smtp.gmail.com:587 -S from=" username @gmail.com" -S smtp-auth-user=username@gmail.com -S smtp-auth-password= ashalkshalkhsbzxn -S ssl-verify=ignore  -s "LOGIN ALERT" -v " tousername @gmail.com" exit 0  Save and close. $ sudo chmod +x /usr/local/bin/takepic Step 4 : Change the pam.d Backup the original file $ sudo cp

Elemental Skills required by Programmers

 Qualities required by the programmers  Memory Observation Critical Thinking KISS Principal Learn, Unlearn, Relearn Frugality I have only listed out the skills needed for problem solving, skills like team work, communication, .., etc are not discussed but equally important. Memory Memory plays an important role in increasing the productivity of development.  When we search internet it may seem like we doesn't spend much time. According to several reports employees spend up to 30 % time searching for information.  On avg I spend 5 to 30 mins searching for answers depending on the problem.  But it doesn't mean you should memorize everything. Try to memorize things you use often. Which will definitely save a lot of time. There is another problem with memorizing is it creates Einstellung . Which is a mental block or mind set which we cannot think past. Observation  Observation also plays an important role in programming. We have go through all the lines of code. Our mind tricks us

Save photos when entering wrong password in Ubuntu

Step 1 : Installing App to take photo (optional if already exists) For more ways to take picture refer this article . $ sudo apt update $ sudo apt install ffmpeg Step 2 : Create script to save photos $ sudo gedit /usr/local/bin/takepic Paste the following #!/bin/bash filename=`date +%s` ffmpeg -f video4linux2 -s vga -i /dev/video0 -vframes 1 /tmp/$filename.jpg exit 0 Save and close. $ sudo chmod +x /usr/local/bin/takepic Step 3 : Configure PAM  Backup the original file $ sudo cp /etc/pam.d/common-auth /etc/pam.d/common-auth.orginal $ sudo gedit /etc/pam.d/common-auth Update auth    [success=1 default=ignore]    pam_unix.so nullok_secure To auth    [success=2 default=ignore]    pam_unix.so nullok_secure Add the following, next to the updated line auth    [default=ignore]               pam_exec.so seteuid /usr/local/bin/takepic Then save it. Try and have fun That's it folks!    

How to send mail from terminal in Ubuntu

Image
There are multiple ways to send mail. Postfix is one of them.  Step 1: Install Postfix  $ sudo apt update $ sudo apt install postfix Select Internet site.  Next, You can type any domain here. we can change it later. Step 2: Save Gmail password Create a new file $ sudo nano /etc/postfix/gpasswd     [smtp.gmail.com]:587 username@gmail.com:password Step 3: Configure postfix $ sudo nano /etc/postfix/main.cf Add or update the properties smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_security_options = smtp_sasl_password_maps = hash:/etc/postfix/gpasswd smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt $ sudo postmap /etc/postfix/gpasswd $ sudo systemctl restart postfix  mail -s "Subn" username@gmail.com CC: Enter the message Press Ctrl + D to send message. That's it folks.