Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Carter Fyko

🏠
Working from home
View GitHub Profile
View INSTALL.md
sudo wget -O /usr/bin/envup https://gist.githubusercontent.com/Fyko/6bb4e995e58a9605eebdab85b749308d/raw/d9e7edbeae7cd76a9eae683c3926dd12b65c8a87/envup.sh
sudo chmod +x /usr/bin/envup
View README.rs
fn main() {
println!("hello world");
}
@Fyko
Fyko / index.ts
Last active September 5, 2022 23:27
Use an unspported Node.js version in AWS Lambda (fusebit/anynode) (serverless-stack)
View index.ts
#!/usr/bin/env node
import { App } from '@serverless-stack/resources';
import { request } from 'undici';
/** eg: `us-west-1`, `us-east-2` */
type AWSRegion = string;
/** eg: `18.4.0`, `16.14.0`, `14.17.0` */
type SemVersion = `${number}.${number}.${number}`;
/**
@Fyko
Fyko / function.ts
Last active July 11, 2022 18:33
Machine Token Handling for Hasura w/ Auth0
View function.ts
// MIT License - Copyright (c) 2022 PUSHAS PTY LTD.
import { ResourceNotFoundException, SecretsManager } from '@aws-sdk/client-secrets-manager';
import { SecretsManagerRotationHandler } from 'aws-lambda';
import fetch from 'node-fetch';
const secretsClient = new SecretsManager({});
export const generateAccessToken = async (roles: string) => {
const response = await fetch(`https://${process.env.AUTH0_M2M_DOMAIN}/oauth/token`, {
method: 'POST',
View smartChunk.ts
/**
* Chunks an array of strings into an array of an array of strings
* where the total characters of the strings in each chunk is less than
* or equal to `maxChunkCharacters`.
* @param data An array of strings
* @param maxChunkCharacters The maximum amount of characters that should be allowed per chunk
* @param join The character that each string will later be joined on
* @returns An array of an array of strings
* @example
* ```ts
@Fyko
Fyko / ME.txt
Last active April 17, 2021 19:46
Sponsor Roles Metadata
View ME.txt
Fyko#0001 (492374435274162177)
@Fyko
Fyko / LogHandler.ts
Last active July 18, 2021 22:13
utility for batch-handling general discord server logs, sending 10 embeds at a time
View LogHandler.ts
/**
* Copyright 2021 Carter "Fyko" Himmel
*
* 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:
*
View okay.txt
NzA3OTk1NjY1NjYxMTY1NTY4.XrQ6WA.yC8FjGmM3KbO0dD1wNP3jqNzq2c
@Fyko
Fyko / ExtendedGuild.ts
Last active September 4, 2020 04:22
collector for guild member add event in discord.js
View ExtendedGuild.ts
import { Client, Collection, GuildMember, Snowflake, Structures, Guild as ImportedGuild } from 'discord.js';
import GuildMemberCollector, { GuildMemberCollectorOptions } from './GuildMemberCollector';
type MemberCollection = Collection<Snowflake, GuildMember>;
declare module 'discord.js' {
interface Guild {
awaitMembers(
filter: (member: GuildMember) => boolean,
options?: GuildMemberCollectorOptions,
@Fyko
Fyko / rest.rs
Created August 19, 2020 03:46
client for interacting with https://github.com/spec-tacles/proxy
View rest.rs
#[macro_use]
extern crate log;
use anyhow::Result;
use rustacles_brokers::amqp::AmqpBroker;
use serde_json::{from_slice, to_vec};
use std::collections::HashMap;
use tokio::time::{delay_for, timeout, Duration};
pub use proxy::models::*;