Skip to content

Instantly share code, notes, and snippets.

View Mulperi's full-sized avatar
🎯
Focusing

Mika Mulperi Lakanen Mulperi

🎯
Focusing
View GitHub Profile
@Mulperi
Mulperi / protracker2.md
Created April 5, 2024 05:09
Protracker 2 cheatsheet

Protracker 2 for windows cheatsheet

Play, stop

  • Space to enter/exit edit mode
  • Alt gr to play pattern

Speed, tempo

  • F01 - F1F Speed range (default F06) define ticks in one row
  • F20 - FFF Tempo range (default F7D)
@Mulperi
Mulperi / bfs.lua
Created April 18, 2023 12:59
PICO-8 Lua breadth first search pathfinding
function inlist(list, item)
for i=1, #list do
if list[i].x == item.x and
list[i].y == item.y then
return true
end
end
return false
end
@Mulperi
Mulperi / raycast.p8
Last active April 17, 2023 08:05
PICO-8 raycast test
function _init()
tile = 8
gridlength = 8
player = {
x = 8,
y = 8
}
map = {
@Mulperi
Mulperi / main.lua
Created April 13, 2023 08:35
Love2d raycasting test
-- 1. make zip and rename it to .love
-- 2. copy /b love.exe+mygame.love mygame.exe
-- or cmd /c copy /b love.exe+mygame.love mygame.exe
-- D:\repos\love-11.4-win64/lovec.exe .
function love.load()
TileSize = 32
GridLength = 16
Player = {
@Mulperi
Mulperi / raycast.lua
Created April 13, 2023 05:55
simple raycasting
RayCast = function(grid, cellX, cellY)
local points = {}
for angle = 0, 360, 1 do
local radius = TileSize
local targetX = cellX * TileSize
local targetY = cellY * TileSize
for i = 1, love.graphics.getWidth(), 1 do
if not PixelOutOfBounds(targetX, targetY) and
GetCellByPixelCoordinates(targetX, targetY, grid, TileSize) == 0 then
@Mulperi
Mulperi / bfs.lua
Last active March 24, 2023 08:37
Breadth first search simple pathfinding
-- Breadth first search.
function Bfs(startCell, targetCell)
local queue = {}
local path = {}
startCell.visited = true
table.insert(queue, startCell)
while #queue > 0 do
local currentCell = queue[1]
@Mulperi
Mulperi / index.js
Created July 13, 2022 13:24
simple jwt with mongoose
import express from 'express';
import jwt from 'jsonwebtoken';
import bodyParser from 'body-parser';
import bcrypt from 'bcrypt';
import mongoose from 'mongoose';
import 'dotenv/config'; // Import and configure dotenv.
import User from './user.js';
const app = express();
app.use(bodyParser.urlencoded({ extended: false })); // Parses urlencoded bodies.
@Mulperi
Mulperi / todos.effects.ts
Last active January 13, 2022 08:22
React redux-saga with websocket
import { put, take, takeEvery, call, select } from "redux-saga/effects";
import { eventChannel } from "redux-saga";
import { io, Socket } from "socket.io-client";
/* Event channel for converting incoming socket messages to saga events. */
function createEventChannel(mySocket: Socket<any>) {
return eventChannel((emit) => {
mySocket.onAny((type: string, payload: any) => emit({ type, payload }));
return () => {
mySocket.close();
@Mulperi
Mulperi / node_licenses.py
Created January 13, 2022 08:17
Get all licenses from node_modules
from pathlib import Path
import json
for path in Path('node_modules').rglob('package.json'):
with open(path) as jsonFile:
try:
jsonObject = json.load(jsonFile)
except:
print("ERROR: json load failed")
jsonFile.close()
@Mulperi
Mulperi / license_check.py
Created January 12, 2022 09:41
Get license metadata from installed python package
from importlib.metadata import metadata
print(metadata("flask-cors")["License"])