Skip to content

Instantly share code, notes, and snippets.

View bojidar-bg's full-sized avatar

Bojidar Marinov bojidar-bg

View GitHub Profile
function encript(current, previous) {
previous = previous || 0;
return (current + previous)%27;
}
var Canvas = require("canvas");
var fs = require("fs");
var source = process.argv[2];
//---PREPARE---
source = source.toUpperCase();
@bojidar-bg
bojidar-bg / gpfamr.sh
Last active November 2, 2016 14:37
GPFAMR - Godot "Project" Fixers After Mass Rename (move)
#!/usr/bin/env bash
v=$(echo "$@" | grep -- '-v')
d=$(echo "$@" | grep -- '-d')
sed_command=''
# Doesn't support spaces in names :|
for cf in $(find . -not -path '*.git*' -not -name '* *' -type f | sed 's|\./||g'); do
if [ ! -z "$v" ]; then
@bojidar-bg
bojidar-bg / build-helpers.sh
Last active November 17, 2016 15:27
Godot-buildscripts -- a few buildscripts useful for developing godot
#!/bin/bash
## Helps build/debug/test a Godot (usable for non-godot things as well)
##################
#-----Common-----#
##################
function start {
start=1$(date -u +"%s")
@bojidar-bg
bojidar-bg / Update assets
Last active April 2, 2020 13:24
Scripts for updating Godot demo assets
Scripts for updating Godot demo assets
LICENSE:
Copyright (c) 2020 Bojidar Marinov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@bojidar-bg
bojidar-bg / boxit-solver.js
Created June 18, 2020 00:37
BOXit solver
// This file is made available under the GPLv3 LICENSE
// For more info, see https://www.gnu.org/licenses/gpl-3.0.html
// Based on ideas presented in https://hatnix.itch.io/boxit
function main() {
// HGrid format:
// All whitespace is ignored.
// Other characters represent tuples of color and symbol
// Colors are [w]hite/[r]ed, [b]lue, [g]reen, [o]range/[y]ellow, [p]urple/pink
@bojidar-bg
bojidar-bg / ObjectParameterConstructorConverter.cs
Last active November 12, 2020 18:51
JsonConverter for System.Text.Json with support for immutable classes, fields, and polymorphic types
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
// Via https://gist.github.com/bojidar-bg/8124db51da853384bd03f3fa0ef71a35
public class ObjectParameterConstructorConverter : JsonConverterFactory
@bojidar-bg
bojidar-bg / README.md
Created September 6, 2022 18:00
Trilium -> TiddlyWiki converter & Pandoc WikiText writer

Status: WIP

This is a quick and dirty script + pandoc lua filter I used to import notes from Trilium into TiddlyWiki.

Usage instructions:

  1. Export root note from Trilium as HTML files in a ZIP (enter protected mode to export protected notes too).
  2. Extract the ZIP file to a directory.
  3. Put process.sh and write-wikitext.lua in the root directory.
  4. Edit process.sh to match your exported root note name (change "root" and "transformed-root").
  5. Edit write-wikitext.lua (line 93 and perhaps 95) to match your TiddlyWiki name.
@bojidar-bg
bojidar-bg / raymarching.html
Created July 30, 2018 19:52
WebGL Raymarcher
<!DOCTYPE html>
<!-- Thanks to Inigo Quillez (http://iquilezles.org) for many of the functions in the shader code. -->
<!-- Thanks to MDN for being awesome. -->
<!-- Thanks to WebGLFundamentals (https://webglfundamentals.org) for their framebuffer tutorial. -->
<!-- Thanks to gl-matrix.js for the matrix library, and Stats.js for the FPS counter. -->
<html>
<head>
<meta charset="utf-8">
<title>Raymarcher</title>
<style media="screen">
@bojidar-bg
bojidar-bg / LinkedList.gd
Last active August 29, 2023 20:51
DEPRECATED Linked List for Godot -- see link below
##
## WARNING: Deprecated. Use https://gist.github.com/belzecue/6253c8c694d602e715fff0b3f4303344/ instead.
##
extends Reference
class LinkedListItem:
extends Reference
var next = null
@bojidar-bg
bojidar-bg / Bin.i
Last active September 23, 2023 19:10
Binary type with addition and multiplication for interaction nets, https://inet.run/playground/
// Example usage:
// let bsix = b0(b1(b1(bend())))
// let nseven = add1(add1(add1(add1(add1(add1(add1(zero())))))))
// let bseven = ntob(nseven)
// eval @inspect(bmul(bsix, bseven)) // -> takes 75 steps; doing the same with Nat mul takes 123 steps
// Type defitinion
type Bin