This file contains hidden or 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 moviepy.editor as mp | |
| clip = mp.VideoFileClip(r"path/to/file.mp4") | |
| clip.audio.write_audiofile(r"path/to/file.mp3") |
This file contains hidden or 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 naiveSearch(pattern, str){ | |
| const P = pattern.length, TXT = str.length | |
| for(let i = 0; i <= P + TXT; i++){ | |
| let pivot | |
| for(pivot = 0; pivot < P; pivot++){ | |
| if(str[i + pivot] !== pattern[pivot]) | |
| break | |
| } | |
| if(pivot == P){ | |
| return i |
This file contains hidden or 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
| if (process.argv.length <= 2) { | |
| console.error("Expected arguments"); | |
| process.exit(1); | |
| } | |
| const { Configuration, OpenAIApi } = require("openai"); | |
| const configuration = new Configuration({ | |
| apiKey: process.env.OPENAI_API_KEY, | |
| }); |
This file contains hidden or 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
| // maybe will not work properly | |
| function convertMarkdownToObject(table) { | |
| const rows = table.trim().split('\n'); | |
| const headerRow = rows.shift().replace(/\|/g, '').trim(); | |
| const columns = headerRow.split(/\s+/); | |
| const objects = rows.map(row => { | |
| const cells = row.split('|').map(cell => cell.trim()); | |
| return columns.reduce((obj, col, i) => { |
This file contains hidden or 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
| // working by need some adjusments | |
| function convertToMarkdownTable(data){ | |
| const rows = data.trim().split('\n'); | |
| const tableHeader = Array.from({ length: 41 }, (_, i) => `Column ${i + 1}`); | |
| const tableSeparator = tableHeader.map(() => '---'); | |
| const headerRow = `| ${tableHeader.join(' | ')} |`; | |
| const separatorRow = `| ${tableSeparator.join(' | ')} |`; | |
| const bodyRows = rows.map(row => { | |
| const cells = row.split('|').map(cell => cell.trim()); |
This file contains hidden or 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
| const chain = () => ({ | |
| value: "", | |
| counter: 0, | |
| increment(x){ | |
| this.counter += x | |
| return this | |
| }, | |
| setValue(newValue){ | |
| this.value = newValue | |
| return this |
This file contains hidden or 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
| use std::fs::File; | |
| use std::io::{self, Write}; | |
| use std::mem::size_of; | |
| use std::f32::consts::PI; | |
| // wave file structure reference: | |
| // https://ccrma.stanford.edu/courses/422-winter-2014/projects/WaveFormat/#:~:text=A%20WAVE%20file%20is%20often,form%20the%20"Canonical%20form". | |
| // .to_le_bytes() return the memory representation of this integer as a byte array in little-endian byte order. I use as alternative to byteorder |
This file contains hidden or 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
| #include <cmath> | |
| #include <fstream> | |
| #include <iostream> | |
| const int sampleRate = 44100; | |
| const int bitDepth = 16; | |
| class SineOscillator { | |
| float frequency, amplitude, angle = 0.0f, offset = 0.0f; |
This file contains hidden or 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 binaryToText(binString){ | |
| let result = '' | |
| for(let item of binString.split(' ')){ | |
| const str = parseInt(item, 2) | |
| result += String.fromCharCode(str) | |
| } | |
| return result | |
| } |
This file contains hidden or 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 pytube import Playlist, YouTube, exceptions | |
| import argparse | |
| import os | |
| parser = argparse.ArgumentParser(description="Playlist link") | |
| parser.add_argument("playlist", metavar="playlist", type=str, help="enter your playlist link") | |
| args = parser.parse_args() | |
| playlist = args.playlist | |
| destination = "./audios/" |