Skip to content

Instantly share code, notes, and snippets.

@Andreal2000
Andreal2000 / WhitespaceEvaluator.scala
Last active January 25, 2024 22:31
Whitespace Programming Language evaluator written in Scala using the Scala Parser Combinators
import scala.util.parsing.combinator.JavaTokenParsers
import scala.collection.mutable.{Stack, Map}
import scala.io.StdIn.{readLine, readInt}
class WhitespaceParser extends JavaTokenParsers {
override val whiteSpace = """[^ \n\t]+""".r
var stack = Stack[Int]()
var heap = Map[Int, Int]().withDefault(_ => 0)
var subroutines = Map[String, Int]()
@Andreal2000
Andreal2000 / post_nb_cleaner.py
Created December 13, 2023 16:58
Jupyter Notebook output cleaner Git Hooks
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
tmp_extension = "tmp"
current_dir = os.getcwd()
list_of_files = []
@Andreal2000
Andreal2000 / crea_scrapper.py
Last active August 21, 2023 17:29
Script to scrap the CREA Food Composition Tables present on https://www.alimentinutrizione.it/
import pandas as pd
import urllib.request
import re
import json
import copy
def translate_template(translation_path, template_path, output_path):
"""Translate a file using a dictionary and save the result on file
@Andreal2000
Andreal2000 / Analize-on-Lichess.js
Last active July 5, 2023 13:47
This plugin adds a button next to the chess board allowing to analyze the game on lichess.org
// ==UserScript==
// @name Analize on Lichess
// @namespace Andreal2000
// @match https://www.chess.com/game/*
// @run-at document-end
// @grant none
// @version 1.0.0
// @author Andreal2000
// @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://lichess.org&size=128
// @description This plugin adds a button next to the chess board allowing to analyze the game on lichess.org