Install mysql 5.x on any ubuntu based distro

MySQL Download URL

https://downloads.mysql.com/archives/community/

Open the terminal and follow along:

Uninstall any existing version of MySQL

sudo rm /var/lib/mysql/ -R

Delete the MySQL profile

sudo rm /etc/mysql/ -R

Automatically uninstall mysql

sudo apt-get autoremove mysql* --purge
sudo apt-get remove apparmor

Download version 5.x.xx from MySQL site

wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.x.xx-linux-glibc2.x-x86_64.tar.gz

Add mysql user group

sudo groupadd mysql

Add mysql (not the current user) to mysql user group

sudo useradd -g mysql mysql

Extract it

sudo tar -xvf mysql-5.x.xx-linux-glibc2.x-x86_64.tar.gz

Move it to /usr/local

sudo mv mysql-5.x.xx-linux-glibc2.x-x86_64 /usr/local/

Create mysql folder in /usr/local by moving the untarred folder

cd /usr/local
sudo mv mysql-5.x.xx-linux-glibc2.x-x86_64 mysql

Set MySql directory owner and user group

cd mysql
sudo chown -R mysql:mysql *

Install the required lib package (works with 5.6 as well)

sudo apt-get install libaio1

Execute mysql installation script

sudo scripts/mysql_install_db --user=mysql

Set mysql directory owner from outside the mysql directory

sudo chown -R root .

Set data directory owner from inside mysql directory

sudo chown -R mysql data

Copy the mysql configuration file

sudo cp support-files/my-medium.cnf /etc/my.cnf

Start mysql

sudo bin/mysqld_safe --user=mysql &
sudo cp support-files/mysql.server /etc/init.d/mysql.server

Set root user password

sudo bin/mysqladmin -u root password '[your new password]'

Add mysql path to the system

sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql

Reboot!

Start mysql server

sudo /etc/init.d/mysql.server start

Stop mysql server

sudo /etc/init.d/mysql.server stop

Check status of mysql

sudo /etc/init.d/mysql.server status

Enable myql on startup

sudo update-rc.d -f mysql.server defaults

*Disable mysql on startup (Optional)

sudo update-rc.d -f mysql.server remove

– REBOOT!

Now login using below command, start mysql server if it’s not running already
mysql -u root -p

Comment if you have any doubts or questions.

The Fintech Space vs Traditional Banking

“Adoption of FinTech providers for money transfer and payment services rose from 18% in 2015 to 50% in 2017.”

– EY Global banking outlook 2018

Fintech space has grown leaps and bounds and it is literally doing what banks were supposed to be doing in the first place. Even though the traditional banks tried to adopt certain technologies over the years such as mobile banking, e-statements among others, the consumer expectations are changing. The FinTechs has proved to be a boom for both, the banked and unbanked. It’s time to acknowledge these disrupters and look at the ways in which the FinTechs have managed to change the banking experience game.

Banking for Unbanked
There is a major portion of the population which still does not have access to or knowledge of operating the banking services. Digital wallets have thus been a blessing for them. The unbanked or the underbanked rely mainly on the cash-driven economy. Though it is okay to be dependent on cash to make your transactions, but it is better to have the means to convert that cash into digital currency. This not only helps in financial transactions but also provide an added level of security to the monetary assets.

I remember a friend of mine starting a text based search engine solution and getting funded. He targeted a set of people who didnt understand the technology of browsers and internet but could understand the idea of text messages and it was a brilliant solution. The best use case is when you dont have internet to be able to do a specific search and get a response over text.

Interesting areas related to fintech would be..
1. Mobile Payments
2. Chat bots based services
3. Customer expectations
3. Digital money..

Will keep adding more blogs related to this..

Regards
deadbrain

Ionic, Cordova and android hybrid apps on ubuntu (Android)

Steps to build an android hybrid application with node, npm, cordova are as follows

1. sudo apt-get install nodejs npm
2. npm -g install cordova ionic
// For Android
3. sudo add-apt-repository ppa:webupd8team/java
4. sudo apt-get update
5. sudo apt-get install java-common oracle-java8-installer
6. sudo apt install ubuntu-make
7. sudo umake android
8. nano ~/.bash_profile
export ANDROID_HOME=/Development/android-sdk/
export PATH=${PATH}:/Development/android-sdk/platform-tools:/Development/android-sdk/tools
Save the file
9. source ~/.bash_profile
10. Open android studio and install necessary SDK, accept the license.

Once these steps are completed, use cordova to build the app

Will be creating another post explaining those processes

PEM Key – Amazon EC2 instance … Creating a new key…

For creating New Pem key:

Go to EC2 Dashboard > Key Pair > Create Key Pair

This will download pem key file for you.

For SSH access:

You can add your id_rsa.pub to instance ~/.ssh/auth* file. After that, you can ssh to it by using ssh ubuntu@ip
You can use the pem key which is associated with that instance by using ssh -i “file.pem” ubuntu@ip

Accessing new instances

Key Pairs are used to grant access to a newly-launched Amazon EC2 instance when using a standard Amazon Machine Image (AMI) supplied by Amazon. (AMIs from other locations may have their own method of logging-in.)

When the instance is launched, a key pair is specified. The EC2 service will then copy the public half of the key pair to /home/ec2-user.ssh/authorized_keys (path may vary depending upon AMI chosen).

Then, to connect to the instance, use the private half of the key pair, exactly like you showed:

ssh -i joe.pem ec2-user@11.22.11.123
(The ec2-user login is used for Amazon Linux instances. Ubuntu uses ubuntu as the username.)

The name of the key pair to use is shown in the information section of the EC2 instance in the management console:

Key pair in console

Once an instance has been accessed, it is recommended to change the key pair in use, create new users and generally take ownership of the security of the instance. Follow the standard security practices of your organization rather than relying on the key pair used when the instance was launched.

Accessing existing instances

For your particular situation, the instances have already been launched and the ssh key pair that grants access might (or might not!) be the one used when the instance was first launched.

You also mentioned that you can see that they key joe is associated with the instance. In that case, you should try to find joe.pem and login to the instance. If you can’t find that file, try using the id_dsa file instead.

If none of this works, then the problem is one of two things:

You don’t have the key pair that was used when the instance was launched, or
The key pair on the instance itself has been changed (as per security recommendations)
The bottom line is that, without the key pair, you cannot ssh into the instance.

Recovering access

Worst case, if you can’t ssh to the instance, you can still fix things. The general steps are:

Stop the instance (let’s call it Instance A)
Detach the boot volume (let’s call it Volume A)
Start a new instance, or select an existing instance (let’s call it Instance B)
Attach Volume A to Instance B
Login to Instance B and copy a new public key pair to the .ssh/authorized_keys file on Volume A
Unmount and detach Volume A from Instance B
Attach Volume A to Instance A
Start Instance A
You should now be able to ssh into the Instance.

Some references:

Connecting to Your Linux Instance Using SSH
How to Recover an Unreachable Linux Instance

What is Digital currency! and why so much hype!

Digital currency or digital money or electronic money is distinct from physical (such as banknotes and coins). It exhibits properties similar to physical currencies, but allows for instantaneous transactions and borderless transfer-of-ownership. Examples include virtual currencies and cryptocurrencies.

Last year, the US Department of Treasury said that digital currency operates like traditional currency, but does not have all the same attributes — as in, it doesn’t have legal tender. Digital currency, however, is a form of virtual currency that is electronically created and stored.

Bitcoin was created by Satoshi Nakamoto, who published the invention on 31 October 2008 to a cryptography mailing list in a research paper called “Bitcoin: A Peer-to-Peer Electronic Cash System”.

Legality of Mining
Once ASICs are out, ASIC users will still have to spend thousands to make a profit. Well since bitcoins are not really ‘money’ (not legal tender anyway) yet, taxes wouldn’t matter unless you sold it for whatever fiat currency. Other than that can’t see what difference is between mining bitcoins and knitting a scarf. )

Please use the sharing tools found via the email icon at the top of articles. Copying articles to share with others is a breach of FT.com T&Cs and Copyright Policy. Email licensing@ft.com to buy additional rights. Subscribers may share up to 10 or 20 articles per month using the gift article service.

Blockchain has the potential to revolutionise the way we distribute wealth and account for our transactions, just as bartering and banknotes did.

A recent World Economic Forum survey found that most experts think blockchain — the technology that underpins cryptocurrencies such as bitcoin — will become mainstream by 2025. So is blockchain the future of money, or is it all fantastical hype?

Izabella Kaminska of FT Alphaville believes blockchain and bitcoin are a flawed solution to a problem that does not exist. Simon Taylor, co-founder and blockchain director of 11:FS, a london-based fintech company, believes cryptocurrencies will play an important economic and business role within two decades. They discussed the topic on ft.com, aided by questions and comments from FT readers and moderated by Carola Hoyos, editor of Working in Accountancy, in a debate for this report.

A Quick Ubuntu Disk Cleaner Script

At times your disk space keeps increasing to dangerous levels till you notice…

Here is a sweet little trick to cleanup most space in a sec.

Preferably you can make a cron job and run it every week

su -c "echo 3 >'/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'" root
find /var/log/ -name “*.tar.gz” -type f -delete
find /var/log/ -name “*.1” -type f -delete

Works on Servers and Desktops

Search for content in a file and show surrounding lines (Ubuntu)

There are instances where you need to search for contents in a file and see the surrounding lines as well, Searching for it and then opening the file and search again is a pain and it is time consuming. Here is a quick shortcut..

 

For BSD or GNU grep you can use -B num to set how many lines before the match and -A numfor the number of lines after the match.

grep -B 3 -A 2 foo README.txt

If you want the same number of lines before and after you can use -C num.

grep -C 3 foo README.txt

This will show 3 lines before and 3 lines after.

Installation on a fresh Ubuntu 14.04 LTS

Image

Step by Step Guide to Cuda Mining on Ubuntu 14.04 LTS (as simple as copy paste)

  1. After Ubuntu is installed and ready, click on the ubuntu icon on the side bar or press windows key on your keyboard type additional drivers and open the application. You will have 4 to 5 choices depending on your nvidia graphics card
    • Either select the one which has recommended
    • Or choose the one which says tested
  2. Apply the changes and wait for it to install. Once it is installed press Ctrl + Alt + F6 to go to command line mode. This is because during the installation of the nvidia driver inside the cuda toolkit, Xserver (the service that enables graphical user interface has to be turned off)
  3. Once in the CLI (Command Line Interface) type (without quotes) ” sudo su ”  and enter your password
  4. Now let us begin preparing the machine for Cuda Mining…
  5. Run the command (without quotes) – ” apt-get update “
  6. Run the command (without quotes) – ” apt-get upgrade “
  7. Run the command (without quotes) – ” apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libglapi-mesa libgl1-mesa-dri “
  8. Run the command (without quotes) – “cd /home/yourusername/Downloads” (Here your username is the name of the user, usually just press the tab key after typing /home/)
  9. Download the toolkit – run the command (without quotes) – “wget http://developer.download.nvidia.com/compute/cuda/6_0/rel/installers/cuda_6.0.37_linux_64.run”
  10. Give execution permission to the file you just downloaded chmod +x cuda_6.0.37_linux_64.run
  11. Stopping the display service  (without quotes) – “service lightdm stop”
  12. Run the installer (the parameter override compiler will negate any compiler version issues)  ./cuda_6.0.37_linux_64.run -override compiler
  13. Give yes for all questions, and when asked for the path where the cuda toolkit and cuda toolkit samples, press enter so that it takes the default location, it will be easier to debug.
  14. You might be asked to re run the setup after restart as the installer will try and remove the other drivers. Once restarted come back to the CLI using Ctrl + Alt + F6 and nagivate to downloads folder (without quote) – “cd /home/yourusername/Downloads/”. After that escalate privilege to root using “sudo su ” command, enter your password if asked.
  15. Run the command (without quotes)  – ” cd “
  16. Edit .bashrc file with the command (without quotes) – nano .bashrc
  17. Add the following to the end of the document – “PATH=$PATH:/usr/local/cuda-6.0/bin”, o the next line (press enter) ” LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.0/lib64:/lib “
  18. Press Ctrl + Y to close press enter to save. You will be back at the terminal. Run  the command (without quotes) : “source .bashrc”
  19. Run the command (without quotes) – ” apt-get install openmpi-bin openmpi-common libopenmpi-dev “
  20. Run the command (without quotes) – ” cd /home/yourusername/NVIDIA_CUDA-6.0_Samples “
  21. Run the command (without quotes) – ” make “
  22. Once the processing is complete and you are back at the cursor (make sure there are no errors.
  23. Run the command (without quotes) ” ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so “
  24. Run the command (without quotes) – ” nano /etc/ld.so.conf.d/cuda.conf “
  25. Inside the file add these 2 lines – ” /usr/local/cuda-6.0/lib64 ” ” /usr/local/cuda-6.0/lib “. Press Ctrl + Y and enter key to save and exit to terminal
  26. Run the command (without quotes) – ” nano /etc/ld.so.conf.d/NVIDIA.conf “
  27. Inside the file add these 2 lines – ” /usr/local/cuda-6.0/lib64 ” ” /usr/local/cuda-6.0/lib “. Press Ctrl + Y and enter key to save and exit to terminal
  28. Run the command (without quotes) – “ldconfig”
  29. Run the command (without quotes) – ” cd ~ “
  30. Run the command (without quotes) – ” cd /home/yourusername/Downloads/ “
  31. Run the command (without quotes) – ” wget https://github.com/cbuchner1/CudaMiner/archive/master.zip
  32. Run the command (without quotes)- “mv master.zip CudaMiner.zip” – For easy understanding
  33. Run the command (without quotes)- “unzip CudaMiner.zip”
  34. Run the command (without quotes) – ” cd sCudaMiner “
  35. Run the command (without quotes) – ” chmod a+wrx configure “
  36. Run the command (without quotes) – ” apt-get install libcurl4-gnutls-dev  autogen automake libssl-dev libssl1.0.0 libcryptokit-ocaml libcryptokit-ocaml-dev libcrypto++-dev libcrypto++9 “
  37. Run the command (without quotes) – ” ./autogen.sh “
  38. Run the command (without quotes) – ” ./configure “
  39. Run the command (without quotes) – ” make “
  40. Run the command (without quotes – ” ./cudaminer -d 0 -i 0 –benchmark “

Once this runs, it means you are ready to mine with cuda miner…

 

Will post how to mine with a pool in a couple of days..

 

Reply / Comment to this blog post or leave a message at iamherevivek@zoho.com, I will reach back to you as soon as I can…

 

Happy Mining

Deadbrain 🙂

Shouts to Christian Buchner & Damian Gregory

Repost of my old blog: https://d3adbra1n.wordpress.com/2014/05/03/cuda-miner-installation-on-a-fresh-ubuntu-14-04-lts