Skip to content

Instantly share code, notes, and snippets.

View matcool's full-sized avatar
🌈
rainbow

mat matcool

🌈
rainbow
View GitHub Profile
@matcool
matcool / dll2lib.bat
Last active May 30, 2024 20:17
dll2lib - generates a .lib file from a dll
@echo off
REM Usage: dll2lib [32|64] some-file.dll
REM
REM Generates some-file.lib from some-file.dll, making an intermediate
REM some-file.def from the results of dumpbin /exports some-file.dll.
REM
REM Requires 'dumpbin' and 'lib' in PATH - run from VS developer prompt.
REM
REM Script inspired by http://stackoverflow.com/questions/9946322/how-to-generate-an-import-library-lib-file-from-a-dll
@matcool
matcool / gen.py
Last active January 9, 2024 19:39
gdstring.lib gen script
import subprocess
out = subprocess.check_output('dumpbin /exports libcocos2d.dll').decode()
# get just the symbol names
out = out[out.find('RVA'):].splitlines()[2:]
lines = []
for line in out:
if not line.strip(): break
lines.append(line.split()[-1])

Guide for cross compiling Windows GD Mods on Linux

Requirements

  • clang & llvm (make sure you have clang-cl)
  • cmake (duh)
  • git

1. Setting up xwin

Install xwin, you can also just use one of the unknown-linux tarballs from the releases

from base64 import b64encode
from os import path
url = input('Input your gdps url (without the / at the end). Reference:\nhttp://www.boomlings.com\nhttp://www.boomlings.com/database\n')
to_replace = 'http://www.boomlings.com'
while len(url) != 24 and len(url) != 33:
print(f'wrong size ({len(url)}), needs to be either 24 or 33')
url = input()
.theme-dark {
--channels-default: #a9a9a9;
--interactive-normal: #c7c7c7;
--interactive-hover: #fff;
--interactive-active: #fff;
--interactive-muted: #5a5a5a;
--background-primary: #060606;
--background-secondary: #131313;
--background-tertiary: #171717;
--channeltextarea-background: #0e0e0e;
@matcool
matcool / raymarching.py
Created April 4, 2019 19:41
Basic ray marching done in python, based of this tutorial: http://jamie-wong.com/2016/07/15/ray-marching-signed-distance-functions/
import math
from PIL import Image
class Matrix:
"""not really a matrix object"""
@classmethod
def fromVector(cls, v):
m = [[] for _ in range(3)]
m[0].append(v.x)
m[1].append(v.y)
@matcool
matcool / base64_decoder.py
Last active July 12, 2018 16:10
really unescessary because of the base64 module but eh
def decode(s):
result = ''
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
for i in range(0,len(s),4):
b = [chars.find(s[j]) for j in range(i,i+4)]
result += chr((b[0] << 2) | (b[1] >> 4))
if (b[2] != 64): result += chr(((b[1] & 15) << 4) | (b[2] >> 2))
if (b[3] != 64): result += chr(((b[2] & 3) << 6) | b[3])
return result
#Based off coding train:
#https://github.com/CodingTrain/Rainbow-Code/blob/master/CodingChallenges/CC_90_dithering
from PIL import Image,ImageDraw
img = Image.open("kitten.jpg").convert("L").convert("RGB")
d = ImageDraw.Draw(img)
for y in range(img.height-1):
for x in range(1,img.width-1):
oldC = img.getpixel((x,y))
factor = 1
newC = []
def get():
return -1