Skip to content

Instantly share code, notes, and snippets.

View iloveitaly's full-sized avatar

Michael Bianco iloveitaly

View GitHub Profile
@iloveitaly
iloveitaly / categorize.py
Created February 9, 2024 00:10
Example of how to categorize emails using openai
import click
import sqlite_utils
import json
import logging
SERVICE = "openai"
PREFIX = ""
logger = logging.getLogger(__name__)
@iloveitaly
iloveitaly / logout_twitter.applescript
Created November 25, 2023 00:37
Logout of Twitter with an Applescript. Fight distraction.
tell application "Safari"
activate
open location "https://twitter.com/logout"
end tell
tell application "System Events"
tell process "Safari"
delay 0.5
click button "Log out" of group 1 of group 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1
end tell
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[pack] )); then
source "$(pack completion --shell zsh)"
fi
@iloveitaly
iloveitaly / 1password.zsh
Last active October 31, 2023 14:43
a zsh plug-in to load the one password shell completions and plugin environment variables
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[op] )); then
eval "$(op completion zsh)"
compdef _op op
# load plugins configuration
if [[ -f ~/.config/op/plugins.sh ]]; then
source ~/.config/op/plugins.sh
fi
fi
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[orbctl] )); then
eval "$(orbctl completion zsh)"
compdef _orb orbctl
compdef _orb orb
fi
@iloveitaly
iloveitaly / netsuite_payment_auto_apply_after_creation.js
Last active October 3, 2023 09:16
Auto-apply NetSuite Customer Payments to NetSuite Invoices when they are Created or Edited
/*
Author: <mike@suitesync.io>
Description: When is invoice is created or edited, any unapplied payments on the customer
are auto-applied to the invoice.
Link: https://gist.github.com/iloveitaly/a35d460b0fb744a290dce3db95873e41
Installation:
1. https://system.sandbox.netsuite.com/app/common/scripting/uploadScriptFile.nl
2. User Event
3. Name: Auto-apply Unapplied Customer Payments
@iloveitaly
iloveitaly / github-copilot-cli.zsh
Last active August 30, 2023 14:26
zinit plugin for github-copilot-cli
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[github-copilot-cli] )); then
eval "$(github-copilot-cli alias -- "$0")"
fi
@iloveitaly
iloveitaly / match_stripe_customers_to_netsuite.rb
Last active August 28, 2023 22:42
Point http://SuiteSync.io/ to use existing NetSuite customers when migrating to Stripe
# Mike Bianco <mike@suitesync.io>
# Description: Script to link Stripe customers to NetSuite customers using email as the primary key
# Link: https://gist.github.com/iloveitaly/3702091fbc22ae464a84436ea4ee3ff6
# Usage:
#
# Requires the following environment variables:
#
# STRIPE_KEY
@iloveitaly
iloveitaly / mailchimp-curl.php
Created December 14, 2010 12:47
MailChimp PHP API using CURL
<?php
class Mailchimp_Core {
var $version = "1.3";
var $errorMessage;
var $errorCode;
/**
* Cache the information on the API location on the server
*/
@iloveitaly
iloveitaly / suitescript_retrieve_customer_id.js
Last active April 17, 2023 23:35
Normalize a NetSuite entity ID to a valid customer internal ID reference using SuiteScript
// Author <mike@suitesync.io>
// ensure that an entity ID is actually a customer ID
// http://blog.prolecto.com/2016/02/12/how-to-distinguish-a-netsuite-entity-as-a-customer-vs-a-project/
function retrieveCustomerId(entityId) {
var isAdvancedJobs = nlapiGetContext().getFeature('ADVANCEDJOBS');
var customerId = entityId;
if(!isAdvancedJobs) {