Skip to content

Instantly share code, notes, and snippets.

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

David Katz dhkatz

🏠
Working from home
View GitHub Profile
@dhkatz
dhkatz / voicechat.lua
Created June 15, 2020 06:37
Garry's Mod Server Optimizations
timer.Create("CalculatePlayersHearing", 0.5, 0, function()
for index, ply in pairs(player.GetAll()) do
if !ply.Char then ply.CanHearTrue = nil ply.CanHear = nil continue end
ply.CanHearTrue = {}
ply.CanHear = {}
for index, pl in pairs(player.GetAll()) do
if !pl.Char then continue end
if pl == ply then ply.CanHear[#ply.CanHear + 1] = ply ply.CanHearTrue[pl] = true continue end
if ply:GetPos():DistToSqr(pl:GetPos()) < GetConVar("Voice.Range")^2 then
ply.CanHearTrue[pl] = true
@dhkatz
dhkatz / SteamUpdateMods.py
Created July 6, 2020 03:07 — forked from firefly2442/SteamUpdateMods.py
AlphaSquad Arma3 Server Update via Steam Workshop
#!/usr/bin/env python
import subprocess, sys, os
STEAM_USERNAME = "steamusername"
STEAM_PASSWORD = "steampassword"
WORKSHOP_IDS = [["843425103", "@rhsafrf"],
["843593391", "@rhsgref"],
@dhkatz
dhkatz / README.md
Last active March 11, 2022 03:07
Sol2 + RTTR

Sol2 + RTTR Example

This isn't tested, but it's basically what I've gotten working in my own project as of now.

RTTR is really cool and will let you save type information for elsewhere in your project (maybe an editor if it's a game engine), but also using visitors will allow you to automatically integrate with other existing libraries like sol2, chaiscript, etc.

The biggest pain point I found was working with the usertypes generically. The documentation is kind of bad in this case.

I thought I could just do this:

@dhkatz
dhkatz / a3update.py
Last active July 1, 2022 20:27 — forked from Freddo3000/a3update.py
Arma 3 Linux server and mod updater (workshop)
#!/usr/bin/python3
# MIT License
#
# Copyright (c) 2017 Marcel de Vries
#
# 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
@dhkatz
dhkatz / curseforge.sh
Last active September 4, 2023 04:25
Script for installing modpacks on Linux
#!/bin/bash
# shellcheck disable=SC2155
#
# CurseForge Installation Script
#
# Server Files: /mnt/server
: "${SERVER_DIR:=/mnt/server}"
: "${PROJECT_ID:=}"
: "${VERSION_ID:=}"
@dhkatz
dhkatz / msys2-visual-studio-code.md
Last active January 28, 2024 21:37
Using MSYS2 with Visual Studio Code

Using MSYS2 with Visual Studio Code is extremely easy now thanks to the Shell Launcher extension by Tyriar.

First, install the extension and reload Visual Studio Code.

Then, open the settings.json to edit your settings.

Add the field shellLauncher.shells.windows. I recommend using autocompletion here so that all the default shells are added.

You should having something like this now: