Skip to content

Instantly share code, notes, and snippets.

View zachlankton's full-sized avatar
🎯
Focusing

Zach Lankton zachlankton

🎯
Focusing
View GitHub Profile
@zachlankton
zachlankton / find_policy_with_action.py
Last active April 26, 2024 11:49
Find policies in AWS that contain some text
import boto3
iam = boto3.client('iam')
def find_policies_with_action(action):
policies = iam.list_policies()['Policies']
for policy in policies:
policy_arn = policy['Arn']
default_version_id = policy['DefaultVersionId']
policy_version = iam.get_policy_version(PolicyArn=policy_arn, VersionId=default_version_id)
@zachlankton
zachlankton / install-foxpro-runtime-deps.cmd
Last active February 21, 2023 15:11
Install FoxPro Runtime Dependencies
@echo off
@echo Downloading VFP 9.0 Runtime...
curl -o VFP9SP2RT.exe https://raw.githubusercontent.com/VFPX/VFPRuntimeInstallers/master/VFP9SP2RT.exe
@echo Downloading VFP ODBC Driver...
curl -o VFPODBC.msi https://raw.githubusercontent.com/VFPX/VFP9SP2Hotfix3/master/VFPODBC.msi
@echo Downloading VFP OLEDB Driver...
curl -o VFPOLEDBSetup.msi https://raw.githubusercontent.com/VFPX/VFP9SP2Hotfix3/master/VFPOLEDBSetup.msi
@zachlankton
zachlankton / totp.ts
Created January 3, 2023 03:36
A simple TOTP File / Mini Library
const Convert: any = {};
//Converts a base32 string into a hex string. The padding is optional
Convert.base32toHex = function (data: string) {
//Basic argument validation
if (typeof data !== typeof '') {
throw new Error('Argument to base32toHex() is not a string');
}
if (data.length === 0) {
throw new Error('Argument to base32toHex() is empty');
@zachlankton
zachlankton / prisma-generator.md
Last active December 1, 2022 12:52
Bare Minumum Prisma Generator Code

Prisma Generator

Bare Minumum Prisma Generator Code

This gist gives you quickest way to get started creating your own prisma generators in your own projects.

If you want to get a little more fancy/advanced and package your generator for the community check out: https://github.com/YassinEldeeb/create-prisma-generator

  • Create the file below in your prisma folder.
  • Make sure to make this file executable
@zachlankton
zachlankton / twmerge-performance-test.md
Created October 22, 2022 15:41
twMerge Performance Test

The Test:

import { noop } from "lodash";
import { twMerge } from "tailwind-merge";

function testTWMerge() {
  const variantClasses =
    "inline-flex justify-center rounded-md border border-transparent bg-primary py-2 px-4 text-sm font-medium text-primaryText shadow-sm hover:ring-2 hover:ring-textShade-900 focus:outline-none focus:ring-2 focus:ring-secondary focus:ring-offset-2 dark:bg-dPrimary dark:text-dPrimaryText dark:hover:ring-dTextShade-900";
@zachlankton
zachlankton / shadeGenerator.js
Created October 18, 2022 16:00
Tailwind Shade Generator
// This code mostly stolen and modified from:
// https://github.com/nickgraffis/tailwind-color-generator/blob/main/logics.js
"use strict";
exports.__esModule = true;
exports.shade = void 0;
var hexToHSL = function (hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
var r = parseInt(result[1], 16);
var g = parseInt(result[2], 16);
@zachlankton
zachlankton / CouchDB_cr_debug.md
Last active August 31, 2022 22:11
Steps to setup Emacs on Ubuntu with ErlangLS extension for CouchDB code_reload and debugging

CouchDB ErlangLS Code Reload and Debugging

This write-up details the steps required to get emacs on ubuntu 20.04 setup with the erlang_ls extension and enable code reloading and debugging.

I'm hoping these instructions should be nearly identical for setup on a Mac.

CouchDB uses long names and the erlang_ls extension defaults to using short names. There is a bug that appends a dot . to the end of the node hostname when using long names and PR to fix it is pending, until then we will need to build the erlang extension from the PR repo so that we can connect ErlangLS to [email protected]

@zachlankton
zachlankton / oracle-cloud-instance-wireguard.md
Last active October 2, 2024 09:31
WireGuard Setup for Oracle Instance Ubuntu 20.04

Setup Oracle Cloud VM as a VPN Tunnel for connected clients on Ubuntu 20.04

Install dnsmasq

apt install dnsmasq -y

Find and add these items to /etc/dnsmasq.conf

@zachlankton
zachlankton / odoo_rfq.php
Last active July 28, 2021 03:59
Odoo RFQ Form Integration Sample
<?php
/*
Plugin Name: CUSTOM Odoo RFQ Integration
Plugin URI:
description: CUSTOM: Pushes data from the RFQ form into the Odoo CRM
Version: 1.0
Author: Zach Lankton
Author URI:
License: GPL2
*/
Copyright 2020 Zach Lankton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHE