Skip to content

Instantly share code, notes, and snippets.

View Whats-A-MattR's full-sized avatar
💻
Always Online, 60% Of the Time

Matt Russell Whats-A-MattR

💻
Always Online, 60% Of the Time
View GitHub Profile
@Whats-A-MattR
Whats-A-MattR / scrub_exif.py
Last active March 11, 2023 07:54
Handy script to cleanse a exif data from an image, writing to a new file to avoid any missed properties
from PIL import Image
import os
import math
import multiprocessing
import threading
cpu_strength = int(math.ceil(multiprocessing.cpu_count() / 2))
if cpu_strength == 0: cpu_strength = 1
img_path = str(input(
from PIL import Image
from PIL.ExifTags import TAGS
import os
# ask for image path
accepted_exts = ['jpg', 'jpeg', 'png', 'gif']
# exits if path not found
img_path = input('please provide path and hit enter: ')
if not os.path.exists(img_path): exit(f'invalid path provided, cannot find anything at {img_path')
@Whats-A-MattR
Whats-A-MattR / merge_keys.py
Created March 8, 2023 04:16
DataBricks DeltaTable Merge() Example, with unique key discovery
# Assumptions;
# you have are working with CSVs that include useful headers
# you are using the 'inferSchema' option when reading those CSVs to DataFrames
# you are writing/updating Delta Tables with those DataFrames
import pandas as pd
import pyspark.sql.functions as F
# change other date formats to strings, useful if you get out of bounds errors when casting timestamp[tz, etc.] to timestamp[n]
def date_to_string(df: DataFrame) -> DataFrame:
@Whats-A-MattR
Whats-A-MattR / email_validation.vue
Last active October 2, 2022 16:00
Vue Email Validation using Vanilla JS / Regex
// this very simple example is referencing bootstrap, but the method will be the same if using other presentation frameworks
<template>
<div>
<div class="floating-form mx-auto">
// create a simple input field, but bound the imput to data property with v-model
<input id="emailaddress" type="email" class="form-control" aria-describedby="email" placeholder="Your Email Address" v-model="mailAddress" />
// create a button that has an @click function, and where disabled is bound to the email_isValid computed property - this means the user will not be able to click when the email is not determined to be valid by the regular expression evaluation
// note that the boolean is flipped here using a '!', this is so that when the email not yet entered or evaluated as invalid the expected value of false, gets set to true to enable the 'disabled' attribute - and vice versa
<b-button @click="submitemail" :disabled="!email_isValid" />
</div>
@Whats-A-MattR
Whats-A-MattR / ICountUP-fromAPI.vue
Last active May 28, 2021 05:33
VueJS + CountUp Component w/ Abbreviation (K,M,B)
<template>
<ICountUP
v-if="loaded"
:delay="delay"
:endVal="shortNum"
:options="options" />
// use a question mark until the number loads, a loading animation would be cool also
<div v-else>?</div>
</template>