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
### Keybase proof | |
I hereby claim: | |
* I am farzadhallaji on github. | |
* I am farzadhallaji (https://keybase.io/farzadhallaji) on keybase. | |
* I have a public key ASCV8BMpAu47N-Ea8q8vlgLrJDiwUitIiNktf_EDl3x8OQo | |
To claim this, I am signing this object: |
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 requests | |
import json | |
auth_token = "eyJhbGciOiJIUzUxMiIsImlhdCI6MTU1MjM3MTg3OCwiZXhwIjoxNTUyMzc1NDc4fQ.eyJlbWFpbCI6Im1vaGFtYWQuYWRrNzhAZ21haWwuY29tIiwicHVibGljX2tleSI6IjAyNzk0NGYwOWY3ZDNiYzk2NTkyNWFhZDBmMDdjNDkxZDY4MmU2YjgxOWNlZTY1Yjg5MzY2NzA4NDJjNDIzY2FmMyJ9.vioLHca_WRfq1QK51lxb_WGEOcSxuq9BPkyyz233vM_mVMBptEHOuwui2l9PeCjw86BBFwXzUmvshhn5_bBlZw" | |
urlP = 'http://212.24.96.236:8040/' | |
def signup(email,passw,label,des) : | |
headers = {'Content-type': 'application/json', 'Accept': 'text/plain' , 'Authorization': 'Bearer ' + auth_token} | |
path = "accounts" | |
payload = { 'label' : label |
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 google.colab import drive | |
drive.mount("/content/drive") | |
import os | |
path = '/content/drive/My Drive/path_to_folder/' #replace path_to_folder with your desired folder path | |
os.chdir(path) |
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
!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64-deb | |
!dpkg -i cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64-deb | |
!ls /var/cuda-repo-9-0-local | grep .pub | |
!apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub | |
!apt-get update | |
!sudo apt-get install cuda-9.0 | |
!pip install thundersvm-cpu |
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 re | |
def read_dot_dat_file(path): | |
datContent = [i.strip().split() for i in open(path).readlines()] | |
r = re.compile("@inputs.*") | |
_at_data = datContent.index(['@data']) | |
assert datContent[0][0] == '@relation' | |
assert datContent[_at_data-1][0] == '@outputs' | |
assert datContent[_at_data-2][0] == '@inputs' | |
assert len(datContent[_at_data-3][2:]) == 2 # Two Class |
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 scipy.stats import hmean | |
# https://stats.stackexchange.com/questions/7471/can-the-standard-deviation-be-calculated-for-harmonic-mean | |
harmonic_var = lambda S : (np.power(S,-1).var())/(len(S)*np.power(np.power(S,-1).mean(),4)) | |
# example | |
import numpy as np | |
np.random.seed(100) | |
s = np.random.dirichlet((1,5),10) |
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
!pip uninstall numpy -y | |
!pip install numpy==1.24.2 | |
!wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz | |
!tar -xzvf ta-lib-0.4.0-src.tar.gz | |
%cd ta-lib | |
!./configure --prefix=/usr | |
!make | |
!make install | |
%cd .. |
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 os | |
from moviepy.editor import VideoFileClip | |
folder_path = '/home/ri/Desktop/TFL/ahmadian' # Replace with the path to your folder | |
total_duration = 0 | |
for file in os.listdir(folder_path): | |
if file.endswith('.webm'): # Adjust the file extension if necessary | |
file_path = os.path.join(folder_path, file) | |
video = VideoFileClip(file_path) |
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
#!/bin/bash | |
# Check if ffmpeg is installed | |
command -v ffmpeg >/dev/null 2>&1 || { echo >&2 "ffmpeg is required but it's not installed. Exiting."; exit 1; } | |
# Check for valid number of arguments | |
if [ "$#" -ne 4 ]; then | |
echo "Usage: $0 input.mp4 start_time end_time output_base_path" | |
echo "Time format: HH:MM:SS or MM:SS" | |
exit 1 |
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
# -*- coding: utf-8 -*- | |
"""vocab.ipynb | |
Automatically generated by Colaboratory. | |
Original file is located at | |
https://colab.research.google.com/drive/1GNxF9QyJc8hL3KgVKB8t4GPgH8sGNTci | |
""" | |
# ! pip install google-translate-for-goldendict |
OlderNewer