Aug 10, 2017

More bash scripting

String split:
-------------------
#!/bin/bash
f="egan#mcclave"
substring="#"
##===========================================================================
# find the 'model_name'
index="$(echo $f | grep -b -o $substring | sed 's/:.*$//')" # redirecting the output of echo into a variable with "$(...)"
#echo $index
first=${f:0:$((index))} # taking the substring 0-index
echo "first : "$first
   
second=${f#*$substring} # find the occurrence of $substring in $f
echo "second : "$second

AutoX demo

http://www.autox.ai

Aug 9, 2017

Nvidia driver from cuda toolkit

I was stuck with this issue for a long time for my Ubuntu 16.04. After installing a fresh copy of Ubuntu 16.04, I installed cuda 8.0 toolkit using the deb(local):

$ sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb

$ sudo apt-get update

$ sudo apt-get install cuda

Nvidia driver is working well on my computer now. Prior to that, I was trying to install Nvidia driver using the *.run file without any luck. Give it a shot it will save your valuable time.


Reference 1
Reference 2

Reference: Somebody liked my solution :D 

Disabling x server

  • Use ctrl + alt + F1 to switch to terminal
  • login with your credentials
  • do:
    • sudo service lightdm stop
    •  lightdm and xserver should be stopped now (check with ctrl + alt + F7 , which is your current xorg session, it should not show any desktop now)
  • Once finished with the installation (or other work) do:
    •  sudo service lightdm start
    • to start lightdm and xorg again

Aug 8, 2017

More bash scripting

        substring="trajectory"
        ##================================================
        index="$(echo $f | grep -b -o $substring | sed 's/:.*$//')" # redirecting the output of echo into a variable with "$(...)"
        #echo $index
        model_name=${f:0:$((index-1))} # taking the substring 0-(index-1)
        echo "model_name : "$model_name
           
        ##=================================================
        # find the 'trajectory_id'
        #expr index "$f" trajectory
        #echo $index
        trajectory_id=${f#*$substring} # find the occurrence of $substring in $f
        #echo $f
        #echo $trajectory_id
        len=$((${#trajectory_id}-4)) # arithmatic operation with $((.)) excluding the .txt extension
        #echo "length is "$len       
        trajectory_id=${trajectory_id:0:$len}
        echo "trajectory_id : "$trajectory_id


Reference
Reference

Aug 2, 2017

Lost my father-in-law

Innalillah i wa inna ilahi rajiun. May Allah grant him jannat and grant peace to his soul in the grave. Sorry Abba! You will be in my prayers.

Jul 16, 2017

Negligent Driving Laws in Maryland

Negligent Driving:
Maryland has another offense called “negligent driving.” Negligent driving—which is a “lesser included offense” of reckless driving—is defined as driving a vehicle “in a careless or imprudent manner that endangers any property or the life or person of any individual.” (Md. Code Ann., Transp. § 21-901(b) (2017).)

The difference between reckless and negligent driving is a matter of degree, and the dividing line isn’t always clear. Basically, reckless driving involves the operation of a vehicle that’s obviously dangerous, whereas more subtle instances of bad driving might be in the negligent driving category.
The penalties for negligent driving are less severe than those for reckless driving. Like reckless driving, negligent driving is a misdemeanor. But the schedule fine for negligent driving is only $140, and the maximum fine a judge can impose in court is $500. A negligent driving conviction puts three points on the driver’s record. (Md. Code Ann., Transp. §§ 16-402, 16-404, 27-101 (2017).)