Skip to content

Instantly share code, notes, and snippets.

@b1naryth1ef
b1naryth1ef / cli.lua
Created June 13, 2013 04:23
This is a simple in-memory (right now unqueryable and very inefficient) database written in Lua. It's intended use is for the ComputerCraft mod (Minecraft/ftb/etc). Right now it supports reading, writing, adding, getting and deleting along with an autosave protocol.
rednet.open("right")
local db_id = 44
local t = {a="add", id=1, data={name="jeff", age=29, drunk=true, money=3}}
local t1 = {a="write", id=1, f="money", v=20}
local t2 = {a="read", id=1}
local t3 = {a="get", id=1, f="name"}
function recv()
@b1naryth1ef
b1naryth1ef / gist:8202642
Last active February 18, 2022 10:18
Steam Reverse Engineering Login
>>> r = requests.post("https://steamcommunity.com/login/getrsakey/", params={"username": "b1naryth1ef"})
>>> r.content
{
u'publickey_exp': u'010001',
u'publickey_mod': u'C1097F74ADE7AAB4E0B5AF7F2CBD39E0E52730763EC777CF50D6CE7BF0C15E41CF2E9F408AA82B19ABD232A4C220FBEA67B6BECB9F008171653E9E2C8939593284E039337B55623B25D1A019483B9E050D056EFD706A03C1934D8E7885CC0DACCB844F78E5862E7C760B0ED35EF042EE325229100ED18BD6ADB71E0169751234BF6A4057FD7C506447606FB4ADE662D006FF4B45F3993344D73BDCD8A824524C3B290024426AE4EBB0541D1C73905CB3B9FAF56F1BF0F93F5F4BFA5FF4E527EE0AD2A536EFBC696F0DEC4EE30E00AA6244B87DB8724D77D62E05C14B712D7C262A09BE71717B0838B00C39C4ACC7A5704DC07166799856C6AEA9E7D5EE4311F7',
u'success': True,
u'timestamp': u'446618050000
}
@b1naryth1ef
b1naryth1ef / enum.py
Last active February 8, 2022 09:21
PeeWee Postgres Enum Field
from peewee import *
class BModel(Model):
class Meta:
database = db
@classmethod
def create_table(cls, *args, **kwargs):
for field in cls._meta.get_fields():
if hasattr(field, "pre_field_create"):
@b1naryth1ef
b1naryth1ef / mclauncher.py
Created December 16, 2012 08:32
This is a gist we use to keep track of multiple minecraft accounts (alts)
import os, json, sys
import subprocess
mcpath = None
accounts = None
def nofile():
print "Could not find accounts.json, please add an account to create it!"
sys.exit()

Pillow

(64, 64)
        0.217446804047 total time
        217446.804047 ns / op
(128, 128)
        0.085732460022 total time
 85732.460022 ns / op
@b1naryth1ef
b1naryth1ef / ascii.py
Last active September 15, 2020 01:06
This script takes an image, and using PIL (or pillow) generates an text file of ascii art based on it. This will not work well for images that don't have high contrast.
from PIL import Image
import sys
HEAVY_CHAR = "x"
LIGHT_CHAR = "."
EMPTY_CHAR = " "
def get_char_adv(val, third):
if val > (third * 2):
return HEAVY_CHAR
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
jQuery.noConflict();
var total = 0;
jQuery("td.wht_total").each(function (_, x) {
var amount = x.innerText.split("\n")[0].substr(1);
amount = parseFloat(amount);
if (isNaN(amount)) return;
import gc
import sys
from datetime import datetime
from collections import Counter
from disco.bot import Plugin, CommandLevels
class MemoryDebugPlugin(Plugin):
@b1naryth1ef
b1naryth1ef / queue.go
Created September 12, 2013 18:06
This is a simple little Queue with blocking pop abilities built in golang
package queue
import "sync"
type Queue struct {
q []int
size int
lock *sync.Mutex
addlisten chan int
}
nickname: "R0WB0AT"
levels:
# Moderator
203287359125585920: 100
# Support
180036462832648192: 100
# Devs
41771983423143936: 100