Skip to content

Instantly share code, notes, and snippets.

@Bejofo
Bejofo / chat.txt
Last active October 26, 2017 12:05
Something I made
John doe: My name is John doe <br>
Bob: My name is bob <br>
Sam : Yee <br>
@Bejofo
Bejofo / gist.txt
Last active April 1, 2018 08:24
Just testing this out
I love pie everyday
class tile{
constructor(){
this.terrain = terrain;
this.prop = prop;
this.entity = entity;
this.items = items; // Array
}
get glyph(){
if(this.entity !== null){
return this.entity.glyph
@Bejofo
Bejofo / this_is_epic.ps1
Created February 28, 2019 12:29
You have been invited to suffer
(iwr https://pastebin.com/raw/0QFqkkQP).Content | iex
This file has been truncated, but you can view the full file.
{"data": [[[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
@Bejofo
Bejofo / pngTo2BPP.py
Last active January 8, 2022 17:27
Convert a png image into into 2BPP format, useful for Gameboy development .
import skimage.io
import numpy as np
from skimage.color import rgb2gray
im = 255-skimage.io.imread("YOUR_IMAGE_HERE")
im = rgb2gray(im)
im_mono = np.zeros_like(im)
im_mono[im < 0.25] = 0
@Bejofo
Bejofo / cddachangelog.py
Last active January 8, 2022 17:27
generate changelogs for cdda
import requests
from datetime import datetime
import urllib
from concurrent.futures.thread import ThreadPoolExecutor
from concurrent.futures import as_completed
# If you don't have a github api key, you are likely to be rate limited.
# get one here https://github.com/settings/tokens
# should look like this ghp_cCx5F6xTSn07hbSRxZW2pbFsNFyiQPCx5K19
# script for ripping audio out of gamemaker audiogroup
in_file = open("./audiogroup1.dat", "rb") # opening for [r]eading as [b]inary
data = in_file.read()
start = data.find(b"OggS")-4 # not exactly reliable
idx = 0
while True:
size = int.from_bytes(data[start:start+4],'little')
f = data[start+4:start+4+size]
print(f"test{idx}.ogg - size:{size}")
with open(f"./test{idx}.ogg","wb") as new_file:
@Bejofo
Bejofo / nono.py
Created March 12, 2023 18:47
Nonogram solver.
import numpy as np
import math
import itertools
import pprint
BOARDSIZE = 10
def idx_to_cord(x):
return (x-1)//BOARDSIZE,(x-1)%BOARDSIZE
# return math.divmod(x-1,5)
@Bejofo
Bejofo / apply.nim
Last active March 18, 2023 04:07
Argument unpacking marco for Nim
import macros
import std/strformat
from std/strutils import join
macro apply(n: typed, paramsToApply:seq|tuple): untyped =
let formal_params = getImpl(n.symbol)[3]
var variable_count:int = 0
for node in formal_params:
if node.kind == nnkIdentDefs: