Skip to content

Instantly share code, notes, and snippets.

View Aniket-508's full-sized avatar
🐢
React' ing

Aniket Pawar Aniket-508

🐢
React' ing
View GitHub Profile
@Aniket-508
Aniket-508 / pi.py
Created January 15, 2022 05:32
Python script to find pi to the Nth digit
from math import factorial
from decimal import Decimal, getcontext
# Chudnovsky algorithm for figuring out pi
getcontext().prec=1000
pi_input = input('How many digits of pi would you like?')
n = int(pi_input)
def cal(n):
t= Decimal(0)
@Aniket-508
Aniket-508 / index.js
Created January 14, 2022 13:21
Node js script to transcribe the song from soundcloud
// Please install the required packages
const scdl = require('soundcloud-downloader').default
const fs = require('fs')
const SOUNDCLOUD_URL = '(Eg: https://m.soundcloud.com/fahad-syed-1/tightrope-x-mashup)'
scdl.download(SOUNDCLOUD_URL).then(stream => stream.pipe(fs.createWriteStream('audio.mp3')))
const { Deepgram } = require('@deepgram/sdk');
@Aniket-508
Aniket-508 / distance.py
Created January 14, 2022 12:54
Python program to find the distance between two addresses using Google Map API
import googlemaps
# Requires API key
gmaps = googlemaps.Client(key='API_key')
# Requires cities name
my_dist = gmaps.distance_matrix('Address1','Address2')['rows'][0]['elements'][0]
# Printing the result
print(my_dist.distance.text)
@Aniket-508
Aniket-508 / uniqueID.js
Created January 14, 2022 05:22
Function to generate random number every single time in javascript.
function create_UUID() {
var dt = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (dt + Math.random() * 16) % 16 | 0;
dt = Math.floor(dt / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
}
@Aniket-508
Aniket-508 / index.js
Created January 14, 2022 04:59
Javascript function to sort the list in ascending order.
function sortList() {
var list, i, switching, b, shouldSwitch;
list = document.getElementById("[id of the ul tag or the list you want to sort]");
switching = true;
/* Make a loop that will continue until no switching has been done: */
while (switching) {
// Start by saying: no switching is done:
switching = false;
b = list.getElementsByTagName("LI");
// Loop through all list items:
@Aniket-508
Aniket-508 / main.py
Created January 13, 2022 16:53
Twitter bot to directly reply to mentions.
import tweepy
import logging
from config import create_api
import time
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
def check_mentions(api, keywords, since_id):
logger.info("Retrieving mentions")
@Aniket-508
Aniket-508 / sudoku.py
Created January 12, 2022 11:52
Program to solve sudoku grid using Python
import numpy as np
grid = [[5,3,0,0,7,0,0,0,0],
[6,0,0,1,9,5,0,0,0],
[0,9,8,0,0,0,0,6,0],
[8,0,0,0,6,0,0,0,3],
[4,0,0,8,0,3,0,0,1],
[7,0,0,0,2,0,0,0,6],
[0,6,0,0,0,0,2,8,0],
[0,0,0,0,1,9,0,0,5],
@Aniket-508
Aniket-508 / encrypt.py
Created January 12, 2022 06:13
Program to encrypt a password using Python
import base64
password = "sweet_kitty".encode("utf-8")
encrypted_password = base64.b64encode(password)
print(encrypted_password)
decrypted_password = base64.b64decode(encrypted_password)
print(decrypted_password)
@Aniket-508
Aniket-508 / area_of_square.lisp
Created January 12, 2022 05:56
Program to find area of a square in Lisp programming language.
(defun AreaOfSquare()
(terpri)
(princ "Enter Side: ")
(setq side (read))
(setq area (* side side))
(princ "Area: ")
(write area))
(AreaofSquare)