Skip to content

Instantly share code, notes, and snippets.

View ChaseIngebritson's full-sized avatar
🏠
Working from home

Chase Ingebritson ChaseIngebritson

🏠
Working from home
View GitHub Profile
@ChaseIngebritson
ChaseIngebritson / !Discord + Google Cloud Text To Speech
Created June 12, 2021 04:00
Convert text to speech using Google's TTS library
Provide any text input and convert it to speech using various international speech patterns provided by Google
Dependencies:
* discord.js
* discord.js-commando
* lodash
* @google-cloud/text-to-speech
@ChaseIngebritson
ChaseIngebritson / webpToJimp.js
Last active November 22, 2023 12:33
Convert a .webp image to be readable by Jimp
// This is a temporary fix until Jimp implements support for webp
// https://github.com/oliver-moran/jimp/issues/144
// const img = await webpToJimp('https://test.com/img.webp', './tmp')
import fs from 'fs'
import axios from 'axios'
import jimp from 'jimp'
import webp from 'webp-converter'
@ChaseIngebritson
ChaseIngebritson / !Serverless_Express_Swagger_JSDocs
Last active May 18, 2021 22:18
Serverless Express Swagger JSDocs
Add documentation to a serverless Express API using JSDoc.
import { Attachment } from 'discord.js'
import puppeteer from 'puppeteer'
import { splitMessage } from '../utils.js'
export default async (msg) => {
const input = splitMessage(msg)
let target
if (input.args.length > 0) {
const target = await msg.channel.fetchMessage(input.args[0])
@ChaseIngebritson
ChaseIngebritson / !AWS_Vue_Deploy
Last active October 16, 2019 19:06
Deploy a Vue web app to different AWS environments with a single codebase.
# AWS environment specific Vue deployment
@ChaseIngebritson
ChaseIngebritson / loadParamStore.js
Last active October 14, 2019 20:29
Loads parameters from the AWS parameter store . Binds the final hierarchy level in the provided name to a corresponding environment variable.
const AWS = require('aws-sdk')
require('dotenv').config()
AWS.config.update({ region: 'us-east-1' });
const ssm = new AWS.SSM()
const params = [
'/WebApp/ead/NodeJS/CampusMap/MONGODB_URI',
'/WebApp/ead/NodeJS/CampusMap/S3_BUCKET'
@ChaseIngebritson
ChaseIngebritson / tileToMesh.ts
Last active May 31, 2023 21:52
Convert a Mapbox RGB tile to a ThreeJS Mesh
import { PlaneGeometry, DoubleSide, MeshBasicMaterial, Mesh, TextureLoader } from 'three';
const MAPBOX_TOKEN = 'Your token';
async function tileToMesh(x: number, y: number, z: number) {
const url = `https://api.mapbox.com/v4/mapbox.terrain-rgb/${z}/${x}/${y}.pngraw?access_token=${MAPBOX_TOKEN}`;
const pixels = await this.getPixels(url);
const planeSize = Math.sqrt(pixels.length / 4);
@ChaseIngebritson
ChaseIngebritson / IsPointInPolygon.js
Last active September 26, 2019 16:14
Check to see if a coordinate is within a given fence.
const fence = [
[44.969886109093, -93.21685776103517],
[44.98627907084557, -93.28243240703127],
[44.9667284078666, -93.28208908427736],
[44.93611398841498, -93.20192322124025],
[44.93605322928645, -93.18498107787336],
[44.956282465359436, -93.18510040629884],
];
// Outside of the fence