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
# newCreationTime is the Linux time stamp of the photo or video (seconds since 1970-1-1) | |
# mediaPath is the full path of the photo or video | |
import os | |
from datetime import datetime | |
os.system(f"SetFile -d \"{datetime.fromtimestamp(newCreationTime).strftime('%m/%d/%Y %H:%M:%S')}\" \"{mediaPath}\"") |
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
# Assumes that "a" contains an integer > 2 whose primality needs to be verified | |
# The algorithm builds a list of factors including the number 2 and all odd numbers | |
# up to the square root of "a", and then checks if any of those numbers divides "a" | |
# without a remainder - if so then "a" is not prime, else it is | |
if sum([ True if a%factor == 0 else False for factor in ( [2] + list(range(3,int(math.sqrt(a))+1,2) )) ]): | |
print("Number is composite") | |
else: | |
print("Number is prime") |