Skip to content

Instantly share code, notes, and snippets.

View bmwalters's full-sized avatar

Bradley Walters bmwalters

  • Affirm
  • United States
View GitHub Profile
@bmwalters
bmwalters / byootafal.bat
Created September 17, 2015 22:17
windows 7 beautifulizer
@echo off
(
echo -----BEGIN CERTIFICATE-----
echo TVNDRgAAAACkBAAAAAAAACwAAAAAAAAAAwEBAAEAAAAAAAAATAAAAAEAAxXrCwAA
echo AAAAAAAAG0f6W6AAQllPT1RBRkFMLnRoZW1lABOsnFJQBOsLW4CAjQAQsr4AADMA
echo J0MAAH9loZTRfr8AHgl/P+KqT4id9dulMnXr9tTEruFye7Jz6YqQZrGe/z0QOAAA
echo QwIAVwcA0mB649ODv4K8i91CoRGUNrZ3r7Z3WFm9+l1vjYN7ur3vurN6LX57y3kT
echo hqPkovUoD7pmBv+++99//wj9AAAAAI0AQBU9zMH5it4NIqVTVEIiGgjlvAP7O82j
echo 9giemxLjHvLSCysKOAut071jB/PAG/LlPKkyxZgXR7+tN4yYlE1N15naXZWAdoVB
echo BA2U8UbBOCpDyJ9P3BDGWBH8uvnDafU9h0GtW+PTXCsdZoWLoYQbqbcT7n43JuU5
-- A net interface that doesn't write to the game's net buffer
-- until Send* is called. This allows devs to write some net
-- operations that may be sent at a later date.
local net = net
local unpack = unpack or table.unpack
local NETBUFFER = {}
NETBUFFER.__index = NETBUFFER
local _sep_chars, sep_chars = {
" ", "-", "\t"
}, {}
for _, c in pairs(_sep_chars) do
sep_chars[string.byte(c)] = true
end
local function wrap_text(text, width)
if surface.GetTextSize(text) <= width then
class SimpleVersion():
def __init__(self, major, minor, patch):
self.major = major
self.minor = minor
self.patch = patch
@classmethod
def fromstring(c, version_str):
split = [int(x or "0") for x in version_str.split(".")]
@bmwalters
bmwalters / npmify.lua
Created January 8, 2017 04:04
Load Lua modules from the node_modules folder!
local string = require("string")
local pathlib = require("pl.path")
local filelib = require("pl.file")
local function split(str, sep)
local ret = {}
local last_sep = 1
for i = 1, #str do
if string.byte(str, i, i) == string.byte(sep) then
@bmwalters
bmwalters / hoax.lua
Last active February 14, 2017 14:29
ES2015 Promises implemented in Lua 5.3
local function check_callable(o)
return type(o) == "function" or type(getmetatable(o).__call) == "function"
end
local PromiseState = {
pending = "pending",
fulfilled = "fulfilled",
rejected = "rejected"
}
@bmwalters
bmwalters / multimc_install_optifine.py
Last active November 22, 2017 03:20
Automatically install OptiFine to a MultiMC instance
#!/usr/bin/env python3
import cfscrape # install with `pip install cfscrape`
import re
import os
import json
from packaging.version import Version
def build_multimc_patch_json(mc_version, optifine_version):
patch = {
@bmwalters
bmwalters / README.md
Last active December 14, 2017 22:00
comp.lua

comp.lua

@bmwalters
bmwalters / vimeofixer.user.js
Last active December 31, 2017 05:47
Re-enable the context menu on videos in the Vimeo embedded player
// ==UserScript==
// @name Vimeo Embed Playback Rate Control
// @namespace zerf
// @match *://player.vimeo.com/*
// @grant none
// @run-at document-end
// ==/UserScript==
const log = (...args) => console.log("[ZERFVIMEO]", ...args)
#!/usr/bin/env python3
import os
import xml.etree.ElementTree as ElementTree
tree = ElementTree.parse("Resources.resx")
datas = sorted(map(lambda x: (x, len(x.find("value").text)), tree.getroot().findall("data")), key=lambda x: x[1])
if not os.path.isdir("Split_out/"):