Skip to content

Instantly share code, notes, and snippets.

View jordanlambrecht's full-sized avatar

Jordan Lambrecht jordanlambrecht

View GitHub Profile
@jordanlambrecht
jordanlambrecht / color-tagger.py
Last active July 6, 2024 22:29
Add the _kMDItemUserTags color tag xattr onto MacOS files via Python
#!/usr/bin/env python3
# Created by Jordan Lambrecht, https://github.com/jordanlambrecht, https://jordanlambrecht.com
# 1) Create an env via `python3 -m venv myenv` and `source myenv/bin/activate`
# 2) Install xattr via `pip3 install xattr`
# 3) Change the variables file_path and color as desired
# 4) Set the script to be executable via `chmod +x ./color-tagger.py`
# 5) Run the script via `python3 ./color-tagger.py`
# 6) Get a broom to push off all the ladies swarming you because of how well-organized and sexy your filesystem is
@jordanlambrecht
jordanlambrecht / NotionDateDifferenceTextFormatter.js
Last active July 5, 2024 14:48
Notion Formula: Time Difference in Years, Months, and Days
# This formula calculates the difference between the current date and a specified “Date Billed” property in Notion. It breaks down the time difference into years, months, and days, and formats the output in a human-readable string. The formula also correctly pluralizes the time units and omits any unit that has a value of zero.
# Logic:
# - if the date range is less than a month, hide the month and years text so it doesn't show 0
# - if the time period = 1, make it singular instead of plural
# - my example uses a date column called 'Date Billed' and outputs to a column named 'Past Due'
# - Not 100% accurate, as it assumes there are 30 days in a month
@jordanlambrecht
jordanlambrecht / docker-compose.yml
Created March 24, 2024 04:16
Docker-Compose Template
---
name: PROJECT_NAME
version: "3.8"
# ╔══════════════════════════════════════════════════════════════════════════════╗
# ║ ║
# ║ TEMPLATE ║
# ║ ║
# ╚══════════════════════════════════════════════════════════════════════════════╝
# COMMON SERVICES FRAGMENT
@jordanlambrecht
jordanlambrecht / createMacUser.sh
Last active February 25, 2024 03:46
MacOS: Create New System User
#!/bin/bash
## This code is based off of https://raw.githubusercontent.com/Servarr/Wiki/master/servarr/servarr-install-script.sh and re-worked for MacOS users
### Boilerplate Warning
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
#EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
#NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
@jordanlambrecht
jordanlambrecht / email-generator-result.php
Created July 30, 2021 16:38
Two php files that Pixel Bakery uses in conjunction to generate our employee's email signatures for Gmail.
<?php
$phoneInput = $_REQUEST['phonepretty'];
$phonePretty = preg_replace('/\D/', ' ', $phoneInput );
$phoneURL = preg_replace('/\D/', '', $phoneInput);
$name = $_REQUEST['name'];
$position = $_REQUEST['position'];
?>
@jordanlambrecht
jordanlambrecht / .gitignore
Created June 7, 2021 04:32
Jordan's Git Ignore Template
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
# ignore everything in the root except the "wp-content" directory.
!wp-content/
# ignore everything in the "wp-content" directory, except:
@jordanlambrecht
jordanlambrecht / autoDeleteGmail.js
Last active July 2, 2024 20:57
Auto Delete / Archive Emails in Gmail
function autoDelete() {
console.log('Started autoDelete run.');
var delayDays = 2;
var maxDate = new Date();
maxDate.setDate(maxDate.getDate()-delayDays);
var label = GmailApp.getUserLabelByName("delete me");
var threads = label.getThreads();
if(threads.length > 0){
console.log('Found ' + threads.length + ' emails marked for deletion.');
@jordanlambrecht
jordanlambrecht / NorthBathroomAmbient.yaml
Created February 20, 2021 03:32
Home Assistant - Google Home - N Bathroom - Ambient Sounds To Poop To
alias: Google Home - N Bathroom - Ambient Sounds To Poop To
description: 'After the N bathroom light has been on for 20s, Check to make sure GH is not in use, then set the volume to 0 and select an ambient track based on time of day, and cast it to the google home for 10 minutes.'
trigger:
- platform: device
type: turned_on
device_id: 43159d577b25076ba654bfbe4f07b252
entity_id: switch.north_bathroom_light
domain: switch
for:
hours: 0