Skip to content

Instantly share code, notes, and snippets.

from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
print('My rank is ',rank)
@harshityadav95
harshityadav95 / script.py
Last active January 15, 2024 09:34
Archived : Initialise CUDA environment on Google Colab
!apt-get --purge remove cuda nvidia* libnvidia-*
!dpkg -l | grep cuda- | awk '{print $2}' | xargs -n1 dpkg --purge
!apt-get remove cuda-*
!apt autoremove
!apt-get update
!wget https://developer.nvidia.com/compute/cuda/9.2/Prod/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64 -O cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64.deb
!dpkg -i cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64.deb
!apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub
!apt-get update
@harshityadav95
harshityadav95 / shell
Created April 28, 2020 20:29
installing Latest Version of Node.js on Ubuntu 20.04 LTS
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt install nodejs
@harshityadav95
harshityadav95 / shell.md
Last active May 2, 2020 07:30
Importing Data in Google Colab Notebook

1 .Using wget

 !wget http://your_domain/your_file.zip
  1. Mounting Google Drive locally
drive.mount(‘/content/gdrive’)
@harshityadav95
harshityadav95 / kraken-in-google-colab.ipynb
Created May 4, 2020 19:33
kraken in google colab.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harshityadav95
harshityadav95 / webcam-in-google-colab-working.ipynb
Created May 5, 2020 15:26
Webcam in google colab working.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harshityadav95
harshityadav95 / hello-world-in-pytorch-creating-neural-network-from-scratch-in-pytorch.ipynb
Created May 13, 2020 14:27
Hello World in Pytorch | Creating Neural Network from Scratch in Pytorch.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def searchIndex(self,arr,target):
low,high=0,len(arr)-1
while low<=high:
mid=low+int((high-low)/2)
if arr[mid][1]>target:
high=mid-1
else:
low=mid+1
return max(0,low-1)
@harshityadav95
harshityadav95 / ApplicationContextConfiguration.java
Created July 15, 2021 19:30
ApplicationContextConfiguration for Spring Web application
package learnmavenone;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration
public class ApplicationContextConfiguration {
@harshityadav95
harshityadav95 / homebrew.mxcl.jenkins-lts.plist
Created September 28, 2021 17:45
How to Setup Docker in Jenkins on Mac
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.jenkins-lts</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/openjdk@11/bin/java</string>
<string>-Dmail.smtp.starttls.enable=true</string>