Skip to content

Instantly share code, notes, and snippets.

View SanjayShetty01's full-sized avatar

Sanjaya J Shetty SanjayShetty01

View GitHub Profile
@SanjayShetty01
SanjayShetty01 / update-all.sh
Created October 9, 2024 15:39
This Bash script provides an automated solution to update packages on a system using three different package managers: DNF, Snap, and Flatpak.
#!/bin/bash
# Update DNF packages
echo "Updating DNF packages..."
sudo dnf upgrade -y
# Update Snap packages
echo "Updating Snap packages..."
sudo snap refresh
@SanjayShetty01
SanjayShetty01 / backup_sync.sh
Last active September 8, 2024 07:40
This shell script uses rsync to synchronize a source folder with a destination on an external SSD. It ensures that the destination is updated with changes from the source folder and removes files from the destination that are no longer present in the source. Hidden files and directories (those starting with a dot) are excluded from the synchron…
#!/bin/bash
SOURCE="/home/sanjaya/"
DESTINATION="/run/media/sanjaya/118b1f77-bf64-4f7a-890d-93ddf02ba531"
rsync -avz --delete --exclude='.*' "$SOURCE" "$DESTINATION"

Why pay off matters more than probability?

Create a Challenge (a bet you can say)

Consider a die. If the face of the die shows a number less than 6 (i.e., 1, 2, 3, 4, 5), you gain $10. However, if it shows a 6, you will lose $50.

Would you take this bet?

@SanjayShetty01
SanjayShetty01 / library_handling_in_R.R
Created December 26, 2023 06:32
Function for Handling Library in R
create_package_path <- function(r_version){
r_version_character <- as.character(r_version)
new_path <- sub("/\\d+\\.\\d+$",
paste0("/", r_version_character), .libPaths())
return(new_path)
}
get_old_packages <- function(old_r_version, path = NULL){
if (is.null(path)) {
old_package_path <- create_package_path(old_r_version)
@SanjayShetty01
SanjayShetty01 / GetScreenColorInLinux.sc
Created December 3, 2023 17:47
Script to get color from the screen in Linux using Scala
import scala.sys.process._
val hex_value = "grabc -hex".!!
val clipboard = java.awt.Toolkit.getDefaultToolkit.getSystemClipboard
val sel = new java.awt.datatransfer.StringSelection(hex_value)
clipboard.setContents(sel, sel)
@SanjayShetty01
SanjayShetty01 / OOP_introduction.scala
Created September 10, 2023 06:46
Rock the JVM OOP introduction in Scala
package oopPractice
object ObjectOrientation extends App {
// the extends App: public static void main(String[] args)
class Animal { // class
// creating fields
val age: Int = 0
// define methods
@SanjayShetty01
SanjayShetty01 / reading_files.scala
Created September 10, 2023 06:44
Different ways to read files in Scala
package fileReader
// four nice ways to read files in scala
import org.apache.commons.io.FileUtils
import java.io.File
import java.util.Scanner
import scala.io.Source
@SanjayShetty01
SanjayShetty01 / what-makes-people-buy-houses_githubcopy.ipynb
Created September 10, 2023 06:30
what makes people buy houses_githubCopy.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
title author date
Implementing INDIAVIX in R
Sanjaya J Shetty
2022-06-15

Calculating India Vix from scratch using R.

We would be referring to the NSE Website for calculating the India Vix Index.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.