Skip to content

Instantly share code, notes, and snippets.

View Kraballa's full-sized avatar
🙂
looking for interesting things

Vinzent Brömauer Kraballa

🙂
looking for interesting things
View GitHub Profile
@Kraballa
Kraballa / ebook_textractor.py
Last active March 28, 2022 08:33
Extracts plain text from epub files. Specify directory in `dir_to_epubs` variable. The extracted `.txt` files will be written to `./epub_text`.
from ebooklib import epub
import ebooklib
import re
import html
import os
#folder to epub files
dir_to_epubs = ''
#generate list of epub-files in specified directory
@Kraballa
Kraballa / epub_generator.py
Last active January 11, 2022 23:18
Provides a class for easy epub file generation. Input files can be regular txt files or more advanced (x)html files. For installation simply get the library 'ebooklib' via pip. Made for Python 3.7.3
from ebooklib import epub
# HOW TO:
# 1. create instance of the class
# 2. set important metadata
# 3. add chapter files and give them a title
# 4. write the finished epub file to disc
class EbookGenerator():
def __init__(self):
@Kraballa
Kraballa / InstantText.md
Last active July 15, 2019 20:41
Wiki entry suggestion detailing how to edit pret/pokecrystal to allow instant text.
@Kraballa
Kraballa / TextGenerator.cs
Created January 29, 2020 18:10
Procedual text generator. See comment for example. Inspired by tracery (http://www.crystalcodepalace.com/traceryTut.html)
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace TextGeneration
{
public static class TextGenerator
{
private static Random rand = new Random();
@Kraballa
Kraballa / encounter_checker.py
Last active October 19, 2020 18:50
pokecrystal encounter checker. check for pokemon without encounters and more
# made for people modifying pret/pokecrystal who want to
# check what pokemon need changes in their wild encounter
# rates. prints 2 tables, one containing a list of all
# pokemon without encounters, one containing all
# encounters sorted by their total overall probability
#
# 1. place this file in your ./tools folder
# 2. make sure the paths and encounter rates below are accurate (only if you changed them)
# 3. if you don't want to incorporate water encounters comment out the last 2 'parse_encounters' lines
@Kraballa
Kraballa / Controller.cs
Last active August 10, 2022 06:21
main game class of a basic FNA project
using Microsoft.Xna.Framework;
namespace YourNamespace
{
internal class Controller : Game
{
private static string Title = "Title";
public const int WIDTH = 1280;
public const int HEIGHT = 720;
const NUM_STEPS = 1000;
const e24 = [1, 1.1, 1.2, 1.3, 1.5, 1.6, 1.8, 2, 2.2, 2.4, 2.7, 3, 3.3, 3.6, 3.9, 4.3, 4.7, 5.1, 5.6, 6.2, 6.8, 7.5, 8.2, 9.1];
const e48 = [1, 1.05, 1.1, 1.15, 1.21, 1.27, 1.33, 1.4, 1.47, 1.54, 1.62, 1.69, 1.78, 1.87, 1.96, 2.05, 2.15, 2.26, 2.37, 2.49, 2.61, 2.74, 2.87, 3.01, 3.16, 3.32, 3.48, 3.65, 3.83, 4.02, 4.22, 4.42, 4.64, 4.87, 5.11, 5.36, 5.62, 5.9, 6.19, 6.49, 6.81, 7.15, 7.5, 7.87, 8.25, 8.66, 9.09, 9.53];
const e96 = [1, 1.02, 1.05, 1.07, 1.1, 1.13, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.37, 1.4, 1.43, 1.47, 1.5, 1.54, 1.58, 1.62, 1.65, 1.69, 1.74, 1.78, 1.82, 1.87, 1.91, 1.96, 2, 2.05, 2.1, 2.15, 2.21, 2.26, 2.32, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.74, 2.8, 2.87, 2.94, 3.01, 3.09, 3.16, 3.24, 3.32, 3.4, 3.48, 3.57, 3.65, 3.74, 3.83, 3.92, 4.02, 4.12, 4.22, 4.32, 4.42, 4.53, 4.64, 4.75, 4.87, 4.99, 5.11, 5.23, 5.36, 5.49, 5.62, 5.76, 5.9, 6.04, 6.19, 6.34, 6.49, 6.65, 6.81, 6.98, 7.15, 7.32, 7.5, 7.68, 7.87, 8.06, 8.25, 8.45, 8.66, 8.87, 9.09, 9.31, 9.53, 9.76];
function build(chain) {
let fileData = "";
fileData += "Version 4\nSHEET 1 880 680\n";
//add all wires
fileData += "WIRE 32 -256 32 -272\n" +
"WIRE 32 -208 32 -256\n" +
"WIRE 32 -96 32 -128\n" +
"WIRE -128 -48 -128 -64\n" +
@Kraballa
Kraballa / SimplexNoise.cs
Created November 9, 2022 15:24
Simplex Noise generator
/// <summary>
/// from http://stephencarmody.wikispaces.com/Simplex+Noise
///
/// blind conversion to C#... let's see what blows up.
///
/// NOT THREADSAFE
/// </summary>
public class SimplexNoise
{
private const float onethird = 0.333333333f;
@Kraballa
Kraballa / cheatsheet.html
Last active February 6, 2024 15:48
Cheatsheet for a few things i keep forgetting. basic python and javascript syntax, css tricks, shell scripts for network namespaces
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: sans-serif;
--code-col: rgba(220, 220, 220, 0.511);
}