Tuesday, July 14, 2020

Amazon Spin and win quiz

How many days are there in month of july
31

Amazon Bournvita quiz answers


1. Orange
2. inner strength formula
3. All the above - strong bones, muscles and active brain
4. Granny prepares one glass
5. hurdle racing

Saturday, June 6, 2020

Launching apps automatically on app at defined time

Hi Guys,
So I wanted my mac to sync one drive in evening (9 pm) instead of keeping the app open throughout the day

Here is how I created a LaunchDaemon and saved it in Library->LaunchDaemons folder

sudo nano com.runOneDrive.plist

Following is the plist file

https://1drv.ms/t/s!AhtxYZmjxi2zhNQuzD9csmBdzPmpww


Ctrl X to save on nano

finally saved the file

And Viola! when the system starts it automatically picks up the job to run at 9 pm daily.


Thursday, June 4, 2020

Apps for mac

Mac doesn't allow to place two windows side by side without going in full screen mode. Enter spectacle, it's a nice app to align windows side by side and work without going in full screen mode. Great app!

Spectacle - https://www.spectacleapp.com

Tuesday, June 2, 2020

Mac bug - Pressing fn key launches Mission Control

So you accidentally press fn key and the apps show up (which is what mission control is) despite not setting fn key as shortcut for mission control.

I believe this issue is a small bug in mac which can be addressed just by resetting mission control short cut (worked for me and many others)

Go to settings -> mission control
Under Keyboard and Mouse Shortcuts
Select Mission Control drop down box and set the shortcut to say - and close the window

Now again go to settings -> mission control and set back the mission control shortcut to whatever you want. Viola! fn key issue is resolved.

Wednesday, May 27, 2020

Clearing History in terminal in mac

Launch terminal and type the command below

rm ~/.bash_history


Now close the terminal using Command + Q and relaunch terminal.

Voila! Now your terminal has only one command in history the above one

Installing and running valgrind on mac

For simple projects in C You can install valgrind on mac by giving the following command in terminal (Note for simple projects in C only since compiling official valgrind code on Mac OS Mojave is very cumbersome and unreliable process, So this is a shortcut.)

brew install --HEAD https://raw.githubusercontent.com/sowson/valgrind/master/valgrind.rb




Bonus:  using valgrind on mac


First compile your code using gcc as follows

gcc -Wall -pedantic -g main.c -o main

Note the use of -g option because we would like valgrind to atleast guide us where the memory leak could be

valgrind --tool=memcheck --leak-check=yes ./main

Look for main.c in your results which will show line number where errors could be.

Cheers!