Saturday, May 30, 2015

> Intense Pain of Kidney Stones

I have experienced it, it's the worse pain you can get. You cannot run away from the pain. It's like getting stabbed with a screw-driver (with studded nails) to your side of the stomach and turning it very slowly.

Laterally I can feel every little movement of stone.  it's like something sharp is ripping through my body very slowly. The pain is caused by the razor sharp-edges of the stone.

When you have the pain only place you can go is to the ER. ER doctors gave me pain killers but that didn't help, I did not feel any relief, so they decided to go for the maximum, since I am having intense pain. They gave me 'Morphine'. Doctors took the signature before the injection of morphine and told me that I would fall asleep after the morphine injection. But surprisingly I did not fall asleep and just got a  little bit of relief, not the kind of relief as they told me.

After a one hour they took me to the CT Scan. As I was preparing for the CT Scan I felt a sudden sledge-hammer blow to the right side of my stomach, the pain is more intense than earlier. Somehow with lot of struggling I managed to do the Scan.  Minutes afters the scan my pain disappeared.

Two hours later I received the CT Scan report and it was a 4.4 mm stone trapped  in the right Ureter.
(Ureter connects Kidney and Bladder)

Doctor asked me to wait for about two months and if the stone does not pass, He would insert a stent to my Ureter to expand the path. and they would remove the stent after one month.

Doctor told me after removal of the Stent, the stone would pass, Hopefully would pass without any pain.

To Avoid such painful situations what you can do is to drink around 2.5 Litters of water every day. Also be careful when you take medications which consists of calcium.

 


Saturday, May 23, 2015

GIT Commands

Working with GIT Locally

Creates a new GIT repository

git init

Adding Files

echo “Hello” > README.txt
git status
git add README.txt

Adds all files including untracked ones

git add –A
git commit
git commit –m “Test Comment”
git commit –am “Add and Commit”

Add all modified files

git add -u
‘-u’ only adds updated files


Commit History

 git log
igt log origin/master
git log -oneline
git log –oneline | wc –l
Shows different branches and merges
git log –oneline --graph

Shows Authors and commit messages

git shortlog
git shortlog -s

Display the last commit

git show HEAD

Diff

git diff dd6819..a15ec6
git diff  HEAD~1..HEAD
git diff HEAD~1..

Remove Files

rm file1.txt
git add -u

Undoing Changes in Local copy

Get the default version of an updated file

git checkout README.txt

Revert several files (Reset the working back to the HEAD)

git reset --hard

Undoing Changes in the Repository

git reset –soft HEAD~1

Move the HEAD back. Delete the last commit and discard all the changes

git reset –hard HEAD~1

Clean the Working Copy

List the files to be cleaned

git clean –n

Clean the repository

git clean –f
 

GIT Ignore File (.gitignore)

You can specify files which you don’t want to commit such as log files.

Working with GIT Remotely

Cloning a Remote Repository

git clone https://github.com/apache/kafka.git

Shows the remote

git remote
git remote –v

Show Branches and Tags

git branch

Shows remote branches

git branch -r
git tag

Sync with remote Repository

Pull down any changes from remote repository

git fetch

Merge data from another branch to current working copy

git merge origin/master

Pull Request 

Performs both Fetch and Merge

 git pull origin master
git branch --set-upstream master origin/master

Push Changes to the Remote Repository

git push
git push --tags

Tags

Displays the Tag

git tag
git tag v1.0
git tag

GIT Branches

List Branches

git log --graph --oneline --all --decorate

Add command allies to Git config

git config --global allis.lga “log --graph --oneline --all --decorate”      
git lga

Creates a new Branch

git branch feature1
git checkout feature1

Rename a Branch

git branch –m fix1 bug1234

Delete a Branch

git branch -d bug1234

Force Delete

git branch -D bug1234

Create and Check out the a branch

git checkout -b feature2

Recovering Deleted commits

git reflog
git branch bug1234 5a78b

Hold Pending Changes

git stash
git stash list
git checkout bug1234
git stash apply

Apply and Delete Stash

git stash pop
git stash drop

Sunday, May 10, 2015

Linux Commands

Archive and Compression

Look inside an Archive:
tar -tzf jdk-7u79-linux-x64.tar.gz

Expand the Archive:
tar -xzvf jdk-7u79-linux-x64.tar.gz
tar -xjvf jdk-7u79-linux-x64.tar.bz2

Create an Archive of directory:
tar -cvf mahesh.tar /mahesh-dir :
-c create, v-verbose, f-file

Extract a .zip file.
unzip file.zip -d destination_folder

List file details in human readable form:
ls -lh

Disk usage of  the current directory:
du -sh
-s : summery

Create an Compressed Archive:
tar -czvf file.tgz /dir
tar -cjvf file.tar.bz2 /dir

Get type of file:
file mahesh.txt

Edit the bashrc file
sudo vim $HOME/.bashrc

Re-load the bashrc file
exec bash

Copy Recursively:
sudo cp -R jdk1.7.0_79/ /usr/811

Delete a non-empty directory
sudo rm -r folderName

Find out where the command is:
which uptime

Logout
Ctrl + D

Long Directory listing with last modified time:
ls -lt /
Reverse listing
ls -lrt /

Write to File:
ls > out.txt

Append to File:
ls >> out.txt
Output standard output
ls /811 1>> out.txt

1 - standard output (default)
2 - error output

Send both error and standard output to the same file:
ls /811 > out.txt 2>&1

Send the output to nowhere:
ls /811 > /dev/null 2>&1

Word count of a file:
wc -l out.txt

Print shell options:
set -o

Prevent overriding an existing file (appending is possible).
set -o noclobber
Override the safety:
ls /811 >| out.txt

Free Disk space
df -h 

Pipes - Send output of one command to input of another

No of lines returned by "ls" command (Un named pipes):
ls -l | wc -l

Named Pipes (Inter process communication - IPC)
Create the named pipe
mkfifo mypipe
ls -l > mypipe
wc -l < mypipe

Delete non empty directory:
rm -rf abc

Search text in a file:
grep error unit-test.log
grep error *.txt

Search with case insensitive way:
grep -i error *.txt

List only directories:
ls -l | grep "^d"
Inverts the search
ls -l | grep -v "^d"

Grep options:
-i - case insensitive
-c - count the occurrences
-l - show line number of occurrences
-v - inverts search

See only lines starting with "ABC"
grep '^server\b' /811
grep '\bserver\b' /811

Find all files in the current directory and its sub directory:
find /811
find .
find /811 -name abc
find /811 -name '*txt'

Find the content of files:
find /811 -name '*txt' -exec grep -l xyz {} \;
find -name FsShell.java -exec vim {} \;

!$ - represents the last argument

Ctrl + r - Reverse searches for your input



Download oracle JDK7 using wget on Ubuntu

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz

Change the URL highlighted yellow according to your download version.