Skip to content

Instantly share code, notes, and snippets.

View DuskyElf's full-sized avatar
🔗
discord - duskyelf

THE DuskyElf DuskyElf

🔗
discord - duskyelf
View GitHub Profile
@DuskyElf
DuskyElf / fib_rec.py
Created May 19, 2024 11:19
Visual Stack trace of recursive fibonacci function
class HorizontalPrint:
def __init__(self):
self.y = 0
self.buffer = [""]
def print(self, v: str):
self.buffer[self.y] += v
self.y += 1
if len(self.buffer) <= self.y:
@DuskyElf
DuskyElf / mealy.py
Created December 29, 2023 11:12
Super simple Mealy machine
from __future__ import annotations
InputSym = int # 0 or 1
OutputSym = str # from State.output
class State:
def __init__(self, name: str) -> None:
self.name = name
self.sigma = [0, 1]
self.output = ["a", "b"]
@DuskyElf
DuskyElf / ollama_discordbot.py
Last active September 20, 2024 03:57
ollama bot integration into discord bot
import os
import discord
import dotenv
import requests
from dataclasses import dataclass
from typing import Optional, Protocol
dotenv.load_dotenv()
@DuskyElf
DuskyElf / sine_freq.c
Created September 8, 2023 10:41
A Simple Sine wave frequency generator
/*
* Freq Generator
* A Simple Sine wave frequency generator
*
* Developed by - DuskyElf
* MIT Licence @duskyelf 2023
*
* compile command -
* `cc -o sine_freq sine_freq.c -lm`
*
@DuskyElf
DuskyElf / LinkedList.py
Last active October 24, 2022 07:51
Simple implementation of Linked List in python
class Node:
def __init__(self, value, prev=None, next=None):
self.value = value
self.prev = prev
self.next = next
def __repr__(self):
return f"Node({self.value})"
class LinkedList:
@DuskyElf
DuskyElf / rps_bot.py
Created October 3, 2022 09:32
Very Simple Rps game in python
from random import randint
gestures = [
"""
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)