Skip to content

Instantly share code, notes, and snippets.

View brycepg's full-sized avatar

Bryce Guinta brycepg

View GitHub Profile
@brycepg
brycepg / fix.patch
Created December 26, 2018 17:31
pyopenssl==0.13 patch
--- OpenSSL/crypto/crl.c 2018-12-26 12:23:14.275648440 -0500
+++ OpenSSL/crypto/crl2.c 2018-12-26 12:15:16.720820270 -0500
@@ -3,7 +3,7 @@
#include "crypto.h"
-static X509_REVOKED * X509_REVOKED_dup(X509_REVOKED *orig) {
+X509_REVOKED * X509_REVOKED_dup(X509_REVOKED *orig) {
X509_REVOKED *dupe = NULL;
@brycepg
brycepg / flask-dynamic-static-endpoint.py
Created July 15, 2020 20:32
Dynamically change flask static endpoint for url_for
# Flask creates a rule for the static endpoint a initialization
# this means that setting static_url_path and static_folder
# after initilzation do not change the result of url_for('static', filename=...)
# app is in instance of the Flask class
# Your new static path, update the instance just to keep everything consistent
app.static_url_path = "/foo"
# Delete the old rule and substitute your own
@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 #
#!/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 / 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
@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 / 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 / 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: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 / 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