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 to determine the OneDrive path based on the operating system | |
get_onedrive_path <- function() { | |
os <- Sys.info()["sysname"] | |
if (os == "Windows") { | |
user_profile <- Sys.getenv("USERPROFILE") | |
onedrive_path <- file.path(user_profile, "OneDrive") | |
} else if (os == "Darwin") { # macOS | |
home <- Sys.getenv("HOME") | |
onedrive_path <- file.path(home, "OneDrive") | |
} else { |
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
def add_times(time_array): | |
total_seconds = sum( | |
sum(map(lambda x, y: int(x) * y, time_str.split(':'), [3600, 60, 1])) | |
for time_str in time_array | |
) | |
hours, remainder = divmod(total_seconds, 3600) | |
minutes, seconds = divmod(remainder, 60) | |
return f"{hours}:{minutes:02d}:{seconds:02d}" |
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 parsePort(url) { | |
// if able to grab item in port array position return it | |
try { return parseInt(url.split(':')[2].split('/')[0]) } | |
// else when fails return null | |
catch { return null } | |
} | |
function parsePath(url) { | |
let tmp = null; | |
// checks to see if on base path. if not returns home (base) path |
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 parsePort(url) { | |
try { return parseInt(url.split(':')[2].split('/')[0]) } | |
catch { return null } | |
} | |
function parsePath(url) { | |
let tmp = null; | |
if (url.split('/')[3] == undefined) return '/'; | |
(url.includes('?')) ? tmp = `/${url.split('/')[3].split('?')[0]}` : tmp = `/${url.split('/')[3]}`; | |
return tmp |
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
// you can write to stdout for debugging purposes, e.g. | |
// console.log('this is a debug message'); | |
function solution(A) { | |
A = new Set(A) | |
A = [...A] | |
A = A.sort(function(a,b){return a-b}) | |
var check = true | |
if (A.length == 1 && A[0] != 1) return 1 |
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
A = [5,6,3,3,1,2,4] | |
// Remove Duplicates | |
A = new Set(A) | |
A = [...A] | |
// Ascending Order 1 first | |
A = A.sort(function(a, b){return a-b}); | |
// Descending Order 1 last |
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
# Python 3.6.7 | |
# OS: Ubuntu 18.04 | |
# Date: 12-14-2018 | |
# Author: Austin Jorgensen | |
# This batch resizes images to the width you set and keeps aspect ratio. | |
import os | |
import PIL # pip install Pillow | |
from PIL import Image |