Friday, November 22, 2024

Installing CodeGPT and Ollama in VSCode for Auto AI code generation.

Lot of tools are persent that help the developer to take the advantages of Auto AI code generation i.e.
1- Codeium – Free
2- Amazon Codewhisper
3- Amazon Q
4- Tabnine- Free
5- Github Copilot- Free for Student and Contributor

Even codeium has introduce the IDE called as windsurf https://codeium.com/windsurf that is build on top of VSCode for the same.

Today we will try to use free tool LLM known as Ollama and VSCode extension called as ChatGPT combination to use the functionality provided by above tools exactly free and also this combination work without internet.

Lets follow the given step religiously

we assume you already have vscode installed if not please free to install the same from below location.
https://code.visualstudio.com/download

once VSCode is installed make sure to installed ChatGPT Plugin as shown below

It is better to create an free account in codegpt on below given site
https://codegpt.co/

After installaion of the plugin you will be able to see this icon on you vscode

Now lets install/download Ollama from the given site
https://ollama.com/

Ollama is available for windows, mac and linux. As i am using window we will download Ollama for windows

Once the exe is download and install make sure Ollama is in running stage in you machine as given below

Additional you can also check using below command

Now if you check https://github.com/ollama/ollama you will find there are so many model available that can be used for AI Auto code generation we will be using Code Llama

Install codellama using below command it will take size of 3.8GB.

ollama run codellama

Try to ask the question and you will get the reply from the codellama

Now lets configure this CodeLlama in our ChatGPT VS code plugin using below steps.

you can also check the model that is installed in your machine using below command

ollama list

In short this blog explain you step for Exploring Free Tools for AI-Powered Code Generation:

A Step-by-Step GuideA Guide to Free AI Tools for Developers: Code Generation Made Easy
In today’s rapidly evolving tech landscape, developers are leveraging AI-powered tools to enhance productivity and streamline workflows. A variety of tools enable developers to take advantage of automated code generation, including:

Codeium – Free
Amazon CodeWhisperer
Amazon Q
Tabnine – Free
GitHub Copilot – Free for students and contributors
Among these tools, Codeium stands out with its dedicated IDE called Windsurf (built on top of VSCode). Explore more about Windsurf here.

In this blog, we’ll explore how you can use Ollama, a free large language model (LLM), in combination with the ChatGPT extension for VSCode, to achieve similar functionalities provided by these tools. What’s remarkable is that this setup works offline, making it a great choice for secure development environments.

Step-by-Step Guide to Setting Up Ollama with ChatGPT
Prerequisites
Before diving in, ensure you have VSCode installed. If not, download and install it from here.

Step 1: Install the ChatGPT Plugin in VSCode
Open VSCode and navigate to the extensions marketplace.
Search for the ChatGPT plugin and install it.
After installation, create a free account at CodeGPT. Once done, you should see the ChatGPT plugin icon in your VSCode interface.

Step 2: Download and Install Ollama
Visit Ollama’s official website to download the tool. Ollama supports Windows, macOS, and Linux.

For this guide, we’ll demonstrate the setup on Windows:

Download the .exe file for Windows.
Install the application by following the on-screen instructions.
Ensure Ollama is running on your machine after installation.
You can confirm this by executing the following command in your terminal:

bash
Copy code
ollama status
Step 3: Explore Available Models in Ollama
Ollama offers several AI models for various use cases. Visit Ollama’s GitHub repository to explore the models. For this guide, we’ll use Code Llama, a powerful model for AI-driven code generation.

Step 4: Install Code Llama Model
To install the Code Llama model, run the following command in your terminal:

bash
Copy code
ollama run codellama
Note: The installation may take some time and requires approximately 3.8 GB of storage space.

Once installed, you can ask questions or provide coding tasks, and Code Llama will generate accurate responses.

Step 5: Integrate Code Llama with the ChatGPT Plugin in VSCode
Now, let’s configure Code Llama in your ChatGPT plugin:

Open the ChatGPT settings in VSCode.
Navigate to the model configuration section.
Link the Code Llama model from Ollama.
You can also verify installed models on your machine using the command:

bash
Copy code
ollama list
This command displays all available models, including Code Llama, ready for use.

Testing the Setup
With everything configured, you can now use the ChatGPT plugin in VSCode with Code Llama to generate, debug, and refine your code. For example:

Ask for help in writing a function.
Request an explanation for a block of code.
Debug errors with AI guidance.

Conclusion
The combination of Ollama and the ChatGPT plugin in VSCode offers developers a free and offline solution for AI-assisted code generation. Whether you’re a student, contributor, or professional developer, this setup provides robust tools to enhance productivity without requiring an internet connection.

Try it out and unlock the full potential of AI in your development workflow!

Thursday, May 16, 2024

Jekyll to Create and Deploy site using github pages

 Jekyll is a static site generator. It takes text written in your favorite markup language and uses layouts to create a static website.

Using Jekyll for creating GitHub Pages offers several benefits, including:

Ease of Backup: Since Jekyll generates static sites, backing up your site is straightforward. You simply need to copy the generated files. This eliminates the complexity associated with databases and ensures that if your server goes down, you can rebuild the entire site from your local copy

Flexibility: Jekyll allows for high flexibility in customization. You can easily add custom meta tags and leverage its theme templating system to tailor the appearance of your site according to your needs

Offline Editing: With Jekyll, you can edit your site offline using any text editor. This approach avoids the issues associated with online editors, such as losing drafts or needing constant internet access. It also means you can work on your site without worrying about server availability 5.
Efficiency: Jekyll sites run quickly and cost-effectively because they don’t require server-side processing like PHP. They can be hosted anywhere that supports file hosting, offering greater versatility in where you choose to host your site.

GitHub Pages Support: Hosting your site on GitHub Pages is free and comes with the added benefits of HTTPS and custom domain support. This makes it a compelling option for those looking for a reliable and cost-effective hosting solution.

Security: Jekyll sites are inherently secure since they consist of flat files. This reduces the risk of vulnerabilities often found in server-side applications. Additionally, hosting on GitHub Pages further enhances security by leveraging GitHub’s infrastructure.

Themes and Plugins: Jekyll supports a wide range of themes and plugins, allowing you to customize your site’s appearance and functionality. You can add a Jekyll theme to your GitHub Pages site to change its look and feel, and extend its capabilities through plugins.

Despite these advantages, it’s important to note that Jekyll might not be the best fit for everyone due to its reliance on local development and the need for familiarity with Git and Markdown. However, for those comfortable with these tools, Jekyll offers a powerful and flexible platform for creating static websites and blogs.

Prerequisites

Jekyll requires the following:

1- Ruby version 2.5.0 or higher
2- RubyGems
3- GCC and Make

lets do the Installation of all. We are using windows OS.

Jekyll is a Ruby Gem that can be installed on most systems.

Requirements

Ruby version 2.5.0 or higher, including all development headers (check your Ruby version using ruby -v)
RubyGems (check your Gems version using gem -v)
GCC and Make (check versions using gcc -v,g++ -v, and make -v)

for windows follow belwo url
https://jekyllrb.com/docs/installation/windows/

1- Download and install a Ruby+Devkit version from this url :- https://rubyinstaller.org/downloads/

we are using rubyinstaller-devkit-3.2.4-1-x64

One you install the above software it will ask for other option to install From the options choose

MSYS2 and MINGW development tool chain.

2- Now Install Jekyll and Bundler using below command

gem install jekyll bundler

3- Check if Jekyll has been installed properly:

jekyll -v

C:\Users\Admin>jekyll -v
jekyll 4.3.3

There are many theme available please refer to https://jekyllrb.com/resources/

for our proof of concept we are going to use belwo theme available on this location

https://jamstackthemes.dev/theme/jekyll-professional-resume/

check out the code to local machine and update the files as per requirement.

run the command bundle as shown below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
C:\to_delete\git-hub\jekyll-professional-resume>bundle
Fetching gem metadata from https://rubygems.org/............
Resolving dependencies...
Fetching mercenary 0.3.6
Fetching rouge 3.30.0
Fetching wdm 0.1.1
Fetching webrick 1.7.0
Fetching tzinfo 2.0.6
Fetching sass-listen 4.0.0
Installing mercenary 0.3.6
Installing rouge 3.30.0
Installing wdm 0.1.1 with native extensions
Installing webrick 1.7.0
Installing sass-listen 4.0.0
Installing tzinfo 2.0.6
Fetching sass 3.7.4
Installing sass 3.7.4
Fetching tzinfo-data 1.2024.1
Installing tzinfo-data 1.2024.1
Fetching jekyll-sass-converter 1.5.2
Installing jekyll-sass-converter 1.5.2
Fetching jekyll 3.9.5
Installing jekyll 3.9.5
Fetching jekyll-feed 0.17.0
Fetching jekyll-seo-tag 2.8.0
Fetching jekyll-sitemap 1.3.1
Installing jekyll-feed 0.17.0
Installing jekyll-seo-tag 2.8.0
Installing jekyll-sitemap 1.3.1
Bundle complete! 10 Gemfile dependencies, 35 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from sass:
 
Ruby Sass has reached end-of-life and should no longer be used.
 
* If you use Sass as a command-line tool, we recommend using Dart Sass, the new
  primary implementation: https://sass-lang.com/install
 
* If you use Sass as a plug-in for a Ruby web framework, we recommend using the
 
* For more details, please refer to the Sass blog:

Finally run this command

1
bundle exec jekyll serve --livereload

and open this url

http://localhost:4000/

you will be able to see follwoing pages

Now lets change the content of the files as required. Open the project in your editor. I am sing VSCode.
Change the files which needed and check your site on url if the code change is reflected.


Once the whole change is done now it is time to upload this theme and text on our github repository.
Make sure to use *.github.io in your repository name as show below

siddhu-jekyll-professional-resume.github.io

Now let build and deploy the project on Github site for that follow the below steps

1- go to setting
2- go to pages
3- under build and deployment keep source as Deploy from a branch and in branch option select the main branch as shown below and save it.
4- Now go to action tab and we will be able to see “pages build and deployment” and an Option on the left side “Deployments” click on it. Make sure the icon on the left side of the “pages build and deployment” should be green with correct.
5- you will get depoyment url of our site build on gitub pages.

Now click on this url

https://shdhumale.github.io/siddhu-jekyll-professional-resume.github.io/

Despite these advantages, it’s important to note that Jekyll might not be the best fit for everyone due to its reliance on local development and the need for familiarity with Git and Markdown. However, for those comfortable with these tools, Jekyll offers a powerful and flexible platform for creating static websites and blogs.

you can download the code from below given location:-
https://github.com/shdhumale/siddhu-jekyll-professional-resume.github.io.git