This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun AreaOfSquare() | |
(terpri) | |
(princ "Enter Side: ") | |
(setq side (read)) | |
(setq area (* side side)) | |
(princ "Area: ") | |
(write area)) | |
(AreaofSquare) |