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
def running_sum_arr_rec(arr, size): | |
""" | |
Running Sum of 1D Array - Recursively | |
""" | |
if size == 1: | |
print(arr[0], end=" ") | |
return arr[0] | |
res = running_sum_arr_rec(arr, size - 1) + arr[size - 1] | |
print(res, end=" ") | |
return res |
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 PyPDF3 | |
import pyttsx3 | |
import pdfplumber | |
import os | |
pdf_file_path = r"path_to_pdf_file.pdf" | |
root, ext = os.path.splitext(pdf_file_path) | |
output_audio_file = root + ".mp3" | |
# get num of pages |
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 timeConverter(UNIX_timestamp){ | |
var a = new Date(UNIX_timestamp); | |
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; | |
var year = a.getFullYear(); | |
var month = months[a.getMonth()]; | |
var date = a.getDate(); | |
var hour = a.getHours(); | |
var min = a.getMinutes(); | |
var sec = a.getSeconds(); | |
var time = date + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec ; |
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 speech_recognition as sr | |
import webbrowser | |
r1 = sr.Recognizer() | |
r2 = sr.Recognizer() | |
with sr.Microphone() as source: | |
print('Dictate some thing to search in YouTube..') | |
url = 'https://www.youtube.com/results?search_query=' |
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
contractions = { | |
"ain't": "am not / are not / is not / has not / have not", | |
"aren't": "are not / am not", | |
"can't": "cannot", | |
"can't've": "cannot have", | |
"'cause": "because", | |
"could've": "could have", | |
"couldn't": "could not", | |
"couldn't've": "could not have", | |
"didn't": "did not", |
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
1- Install PyTorch from the below link. Make sure you select the right CUDA version installed on your device: | |
https://pytorch.org/ | |
2- After a successful installation. Feel free to test the following commands in your Command Line: | |
C:\Users\AhmedBr>python | |
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import torch | |
>>> torch.cuda.current_device() | |
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
public class MainActivity extends AppCompatActivity { | |
ArrayAdapter arrayAdapter; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Toolbar toolbar = findViewById(R.id.toolbar); |
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
int x = 10; | |
int y = 5; | |
Console.WriteLine("Before swapping: x = " + x + ", y = " + y); | |
x = x + y; | |
y = x - y; | |
x = x - y; | |
Console.WriteLine("After swapping: x = " + x + ", y = " + y); |
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
// make sure that your Manifest file has the following line of code: | |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |
// then in you Java code file: | |
private static final int REQUEST_STORAGE_PERMISSION = 1; | |
public void requestPermission() { | |
// if the permission is NOT granted. | |
if (ContextCompat.checkSelfPermission(this, |
NewerOlder