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
@bmwalters
bmwalters / hashleet.lua
Created October 12, 2015 02:11
hash.js leet
cookie.maymays.leetwords = {destroyed = "rekt"}
cookie.maymays.leetpatts = {["(%w+)er"] = "%1or", ["hack(%w+%s)"] = "haxor%1"}
cookie.maymays.leetchars = {a = 4, ["4"] = "a", e = 3, ["3"] = "e", o = "0", ["0"] = "o", l = "1", ["1"] = "l", s = "5", ["5"] = "s", t = "7", ["7"] = "t"}
cookie.maymays.leet = function(inp)
inp = string.lower(inp)
for patt, replacement in pairs(cookie.maymays.leetpatts) do
inp = string.gsub(inp, patt, replacement)
end
for word, replacement in pairs(cookie.maymays.leetwords) do
inp = string.gsub(inp, " "..word.." ", " "..replacement.." ")
@bmwalters
bmwalters / basecalc.lua
Last active December 17, 2015 04:10
anybase^tm calculator (for some reason)
local charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
function ToBase10(num, curbase) -- tonumber has a static charset, we might want to change it in the future so we roll our own
local out = 0
num = tostring(num)
for i = 1, #num do -- this goes left to right
local cur = string.sub(num, i, i)
local val = string.find(charset, cur)
if not val then error("Number '" .. cur .. "' in base " .. curbase .. " not supported by charset '" .. charset .. "'") return end
@bmwalters
bmwalters / maybe.py
Created November 14, 2015 03:15
Object that acts like a boolean, but may be True or False
import random
class _Maybe(object):
def __nonzero__(self):
return bool(random.getrandbits(1))
def __repr__(self):
return repr(self.__nonzero__())
def __str__(self):
@bmwalters
bmwalters / bitwise.arnoldc
Last active March 27, 2018 21:16
Bitwise operators in arnoldc. I used a Lua script to generate the 2800-line band lookup table since there are no arrays in arnoldc currently. I am insane. Thanks to http://stackoverflow.com/a/28332394
LISTEN TO ME VERY CAREFULLY lookupBand
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE key
GIVE THESE PEOPLE AIR
HEY CHRISTMAS TREE val
YOU SET US UP 0
HEY CHRISTMAS TREE isKeyEqualToOurCurrentValue
YOU SET US UP @I LIED
@bmwalters
bmwalters / array2arnoldcfunc.lua
Created November 22, 2015 04:28
converts a lua array to an arnoldc function
local template_start = [[
LISTEN TO ME VERY CAREFULLY %s
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE key
GIVE THESE PEOPLE AIR
HEY CHRISTMAS TREE val
YOU SET US UP 0
HEY CHRISTMAS TREE isKeyEqualToOurCurrentValue
YOU SET US UP @I LIED
@bmwalters
bmwalters / steamid.lua
Last active December 14, 2019 02:26
Lua SteamID class
-- version 1.2.0
-- ported from https://github.com/DoctorMcKay/node-steamid/blob/master/index.js
-- thanks to https://developer.valvesoftware.com/wiki/SteamID
local steamid = {}
steamid.Universe = {
INVALID = 0,
PUBLIC = 1,
BETA = 2,
@bmwalters
bmwalters / b1count.lua
Last active January 13, 2016 22:23
Counts my B1s
local function GetB1Count(sid, callback)
http.Fetch(string.format("http://steamcommunity.com/profiles/%d/inventory/json/753/6", sid), function(c, b)
if c ~= 200 then print("bad code", c) callback(false) return end
local data = json.decode(b)
if data and data.rgInventory then
local count = 0
for _, info in pairs(data.rgInventory) do
if info and tonumber(info.classid) == 171857344 then
count = count + 1
@bmwalters
bmwalters / coolnumbers.py
Created February 9, 2016 16:49
Cool Numbers (http://www.coolnumbers.com) API for Python
import requests
import re
pat_coolness = re.compile(r"<b>Universal Coolness Index</b></a> of <i>([\d\.]+?)%</i>")
pat_attribute = re.compile(r"<li>(.+?)[\.!].+?([\d\.]+?)\%")
pat_tags = re.compile(r"<[^>]+>")
def coolness_to_string(num):
if num >= 99:
@bmwalters
bmwalters / rotatopotato.user.js
Last active April 13, 2016 15:43
shift+p to activate
// ==UserScript==
// @name Rotato Potato
// @namespace zerf
// @description Yep
// @include *
// @version 1.3
// @downloadURL https://gist.github.com/zerfgog/3695d12eac2061f6e29930d7c4fb91ff/raw/master/rotatopotato.user.js
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js
// ==/UserScript==