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 / sfml_box2d_vscode.md
Last active January 9, 2024 00:09
SFML, Box2D in VSCode (macOS)

SFML, Box2D in VSCode (macOS)

Project structure

  • Create new project folder.
  • Inside of the project folder, create folders include and lib.
  • Create main.cpp with code:
  #include "include/SFML/Graphics.hpp"
  #include "include/box2d/box2d.h"
 int main(){}
@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 / disable_mouseacceleration.txt
Created June 6, 2019 17:53
Disable mouse acceleration Linux centOS Gnome
sudo nano /usr/share/X11/xorg.conf.d/50-mouse-acceleration.conf
# paste the following
Section "InputClass"
Identifier "My Mouse"
MatchIsPointer "yes"
Option "AccelerationProfile" "-1"
Option "AccelerationScheme" "none"
Option "AccelSpeed" "-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 / sfml_compile_windows.md
Last active February 5, 2022 11:43
SFML compile from source on Windows

SFML, Windows, VSCode

SFML compile

  • Download SFML source code from https://www.sfml-dev.org/download.php
  • Download CMake from https://cmake.org/download/
  • Open CMake GUI.
  • Enter source code path to CMake (C:/libs/src/SFML-2.5.1).
  • Enter build path to CMake (C:/libs/src/SFML-2.5.1/build).
  • Press Configure and select MinGW Makefiles and Use default native compilers.
  • Now you have SFML-2.5.1/build folder and makefile in there, open terminal inside the new build folder and type: mingw32-make.