Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Gopesh Neptune998

🎯
Focusing
View GitHub Profile
@Neptune998
Neptune998 / insertion_algo2.py
Created Aug 13, 2020
Insertion Sort Algorithm2
View insertion_algo2.py
# Insertion Sort Algorithm2
i1
while i < length(A)
xA[i]
ji - 1
while j >= 0 and A[j] > x
A[j+1] ← A[j]
jj - 1
end while
A[j+1] ← x
View insertion_sort.py
# Insertion sort
def Insertion_sort(arr, itr):
lgth = len(arr)
for i in range(1,lgth):
x,j = arr[i],i-1
while j>=0 and arr[j]>x:
arr[j+1] = arr[j]
j-=1
arr[j+1] = x
print("Iteration:",i,arr)
@Neptune998
Neptune998 / insertion_recursive_algo.py
Last active Aug 13, 2020
Insertion Recursive Algorithm
View insertion_recursive_algo.py
# Insertion Recursive Algorithm
function insertionSortR(array A, int n)
if n > 0
insertionSortR(A, n-1)
xA[n]
jn-1
while j >= 0 and A[j] > x
A[j+1] ← A[j]
jj-1
end while
View sample_class.py
class Website:
def __init__(self, name, url):
self.name = name
self.url = url
def print_url(self):
print("Name of Website " + self.name + "and URL "+ self.url)
web1 = Website("NeptuneWorld", "https://neptuneworld.in/")
web1.print_url()
@Neptune998
Neptune998 / program.slq
Created Aug 18, 2020
Program to output 0 or 1
View program.slq
def main(){
x:=H(false);
return measure(x);
}
@Neptune998
Neptune998 / function_Silq.slq
Last active Aug 18, 2020
How to write a function in silq
View function_Silq.slq
def main() {
x:=H(false);
return measure(x);
}
@Neptune998
Neptune998 / scrape_data_using_python.py
Created Aug 29, 2020
Here we can scrape data using requests module in Python.
View scrape_data_using_python.py
import requests
jsonData = requests.get(r'https://api.stagingjobshq.com/madgexWidgetJobs.php?callback=displayJobs&city=Moorhead&state=Minnesota', verify=False).text.strip()
return jsonData
View javascript_scrape.js
// The name of the Python script that returns the scraped data is scrape_data.py
let scrapeJSON = 'http://bluegalaxy.info/cgi/scrape_data.py'
$.get(scrapeJSON, function(data) {
// Get JSON data from Python script
if (data){
console.log("Data returned:", data)
}
jobDataJSON = JSON.parse(data)
View Video_audio_convertion.py
# Libraries import
import moviepy.editor as mp
# It will clip the video
# subclip(starttime, endtime) to clip portion of video
# you can remove the subclip to convert complete video
clip = mp.VideoFileClip(r"sample1.mp4").subclip(10, 100)
# It will write the audio in converted_audio.wav file.
clip.audio.write_audiofile(r"Converted_audio.wav")