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!

Friday, May 15, 2020

Uploading file from difficult paths in mac

We all know Mac does not show the path like windows. This makes things a little difficult in cases where browser does not support simply dropping the file on tab to upload it. Here is a simple trick to do something like windows in mac.


Go to the folder and copy the folder location to clipboard using Action button.


Press command shift G when you are in open dialog box

Now paste the folder path you copied in your clipboard

Tada! Now you are in the pasted path folder to select and upload in browser.

abcdef

1,2,3,4,5,6,7,8,9;
1,2,3,4,5,6,7,8,9;
1,2,3,4,5,6,7,8,9;

Thursday, May 14, 2020

Gumaan

जिन्हे इतना गुमा है
अपनी रईसी पर
एक दिन उन्हें भी पता चलेगा
बने तो वो भी मिट्टी के ही है ।

Wednesday, May 13, 2020

00000000001

1,2,3,4,5,7,8,9;
1,2,3,4,5,7,8,9;
1,2,3,4,5,7,8,9

Friday, May 8, 2020

My efforts to run c# on visual studio code in mac


Note: This is a work still in progress. I have managed to remove some errors faced but still not able to run the csharp code on Visual Studio code in Mac yet.




1. After installing Omnisharp plugin on visual studio to run c sharp code

It asked to install dot net core on mac directing to microsoft website

The following was installed at /usr/local/share/dotnet
.NET Core SDK 3.1.201
.NET Core Runtime 3.1.3
ASP.NET Core Runtime 3.1.3


2. Installed scriptcs for the first error encountered

brew install scriptcs
To use the assemblies from other formulae you need to set:
  export MONO_GAC_PREFIX="/usr/local"


3. Still was unable to execute csharp code somebody told to modify settings.json by adding following details


settings.json

  "code-runner.executorMap": { "csharp": "scriptcs -script" }


4. To be continued

Wednesday, May 6, 2020

Show full path in sublime text title bar


I would like to see the complete path to file on Sublime Text Title Bar - if you would also like that then come along... :)


Go to Sublime Text -> Preferences -> Settings -> User tab
and add the following line
"show_full_path": true
Tada! Now Sublime Text will show you the complete file path in title bar


Example of my preferences that I have kept
{
 "color_scheme": "Packages/Color Scheme - Default/Mariana.sublime-color-scheme",
 "open_files_in_new_window": false,
 "theme": "Default.sublime-theme",
 "word_wrap": true,
 "show_full_path": true
}