To check if access time logging is enabled, use the mount
command:
mount | grep ' on / '
import zipfile | |
import tarfile | |
import os | |
def zip_folder(folder_path, zip_filename): | |
with zipfile.ZipFile(zip_filename, 'w') as zipf: | |
for foldername, subfolders, filenames in os.walk(folder_path): | |
for filename in filenames: | |
file_path = os.path.join(foldername, filename) | |
arcname = os.path.relpath(file_path, folder_path) |
# -*- 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 |
#!/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 |
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) |
!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 .. |
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) |
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 |
!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 |
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) |