Skip to content

Instantly share code, notes, and snippets.

View brycepg's full-sized avatar

Bryce Guinta brycepg

View GitHub Profile
import argparse
from typing import Optional, List, Mapping, Any
from llama_index.core import SimpleDirectoryReader, SummaryIndex
from llama_index.core.callbacks import CallbackManager
from llama_index.core.llms import (
CustomLLM,
CompletionResponse,
CompletionResponseGen,
LLMMetadata,
@brycepg
brycepg / nginx_install.yml
Last active December 25, 2023 23:54
Install NGINX with ansible
---
- hosts: nginx_deb_websites
become: true
tasks:
- name: ensure nginx is at the latest version
apt: name=nginx state=latest
@brycepg
brycepg / Dockerfile
Last active December 15, 2023 19:18
ansible docker container
FROM ubuntu:22.04
EXPOSE 22
EXPOSE 5984
RUN apt-get update && apt-get install -y openssh-server sudo
COPY --chown=root:root authorized_keys /root/.ssh/authorized_keys
RUN chmod 0644 /root/.ssh/authorized_keys
ENTRYPOINT service ssh start && bash
@brycepg
brycepg / gist:0d8f61215cb90cbf79c6c2baae02394c
Created November 29, 2023 18:13
discord.js installation
irm get.scoop.sh | iex
scoop install nodejs busybox
npm install discord.js dotenv openai
@brycepg
brycepg / index.js
Created November 28, 2023 23:01
Example ChatGPT Discord Bot
import dotenv from "dotenv";
import { Client, GatewayIntentBits, Partials } from "discord.js";
import OpenAI from 'openai';
dotenv.config();
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
@brycepg
brycepg / gist:15f4ff04b58da09cf13afddafd6d8a0e
Created November 27, 2023 22:25
Project Zomboid B41: a list of all vanilla trait refences with their label
AdrenalineJunkie == Adrenaline Junkie
Agoraphobic == Agoraphobic
AllThumbs == All Thumbs
Mechanics == Amateur Mechanic
Mechanics2 == Amateur Mechanic
Fishing == Angler
Asthmatic == Asthmatic
Athletic == Athletic
Axeman == Axe Man
BaseballPlayer == Baseball Player
@brycepg
brycepg / Just_Sleep.lua
Created November 7, 2023 19:33
Mod Example of Multiplayer Sleep
local originalSleepOption = ISWorldObjectContextMenu.doSleepOption
function ISWorldObjectContextMenu.doSleepOption(context, bed, player, playerObj)
-- Avoid player sleeping inside a car from the context menu, new radial menu does that now
if(playerObj:getVehicle() ~= nil) then return end
if(bed and bed:getSquare():getRoom() ~= playerObj:getSquare():getRoom()) then return end
local text = getText(bed and "ContextMenu_Sleep" or "ContextMenu_SleepOnGround")
local sleepOption = context:addOption(text, bed, ISWorldObjectContextMenu.onSleep, player);
-- Not tired enough
-- MOD CHANGE START --
@brycepg
brycepg / tmp.lua
Created November 7, 2023 19:09
doSleepOption dedicated server
ISWorldObjectContextMenu.doSleepOption = function(context, bed, player, playerObj)
-- Avoid player sleeping inside a car from the context menu, new radial menu does that now
if(playerObj:getVehicle() ~= nil) then return end
if(bed and bed:getSquare():getRoom() ~= playerObj:getSquare():getRoom()) then return end
local text = getText(bed and "ContextMenu_Sleep" or "ContextMenu_SleepOnGround")
local sleepOption = context:addOption(text, bed, ISWorldObjectContextMenu.onSleep, player);
local tooltipText = nil
-- Not tired enough
local sleepNeeded = not isClient() or getServerOptions():getBoolean("SleepNeeded")
if sleepNeeded and playerObj:getStats():getFatigue() <= 0.3 then
#!/bin/bash
# file: /usr/local/share/batt.sh
# Checks to see if the battery is below
# the low battery threshold,
# if so, then put the computer to sleep
SECONDS_BETWEEN_CHECK=60
LOW_BATTERY_THRESHOLD=6
@brycepg
brycepg / pylint-df.py
Created March 1, 2022 16:14
Print out inferred types of DataFrame
import astroid
import astroid; astroid.context.InferenceContext.max_inferred = 500
ret = astroid.extract_node("""
import pandas as pd
df = pd.read_csv("some.csv")
df #@
df.columns
df.columns #