Skip to content

Instantly share code, notes, and snippets.

View SealtielFreak's full-sized avatar
🌴
On vacation

SealtielFreak SealtielFreak

🌴
On vacation
View GitHub Profile
@SealtielFreak
SealtielFreak / mcp.py
Last active November 24, 2024 17:57
Implementation of the interface to use the MCP3xxx family in Micropython
class MCP:
def reference_voltage(self) -> float:
"""Returns the MCP3xxx's reference voltage as a float."""
raise NotImplementedError
def read(self, pin: int | None = None, is_differential=False) -> int:
"""
read a voltage or voltage difference using the MCP3102.
@SealtielFreak
SealtielFreak / dummyAuth.ts
Created September 30, 2024 04:54
Dummy auth for Svelte in Typescript
import { writable, type Writable } from "svelte/store";
import axios from "axios";
export type Token = "Authenticated" | "Unauthenticated";
export class UserDataCredentials {
private readonly accessToken: string;
private readonly status: Token;
@SealtielFreak
SealtielFreak / .env
Last active September 20, 2024 21:32
This Docker Compose configuration sets up a development environment with two interconnected containers: one for a FastAPI application and another for a Neo4j database. The FastAPI container serves as the backend application, while the Neo4j container provides the graph database service. Both containers are connected via a custom Docker network t…
DB_NAME=neo4j
DB_USERNAME=neo4j
DB_PASSWORD=my-secret-password
DB_PORT=7687
DB_HOST=graph-db
DB_URL="bolt://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}"
<!DOCTYPE html>
<html lang="en" class="tui-bg-cyan-white">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="https://images.vexels.com/media/users/3/140866/isolated/preview/96676393ee3780e2827a827587feee79-logo-de-msdos.png">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
@SealtielFreak
SealtielFreak / main.ts
Created June 27, 2024 00:44
Storybook config for alias module with Vite
import type { StorybookConfig } from "@storybook/react-vite";
import { mergeConfig } from 'vite';
import path from 'path';
const config: StorybookConfig = {
stories: [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
],
addons: [
import itertools
all_components = 'AB', 'CD', 'EF'
first = all_components[0]
for r in itertools.product(first, *all_components[1:]):
print(*r)
@SealtielFreak
SealtielFreak / scientific_calculator.py
Last active April 6, 2024 00:17
Scientific calculator
import collections
import enum
NUMBERS = "".join(map(str, range(10)))
FLOAT = ".,"
OPERATOR = "+-*/"
PARENTHESIS = "()"
#include <stdio.h>
#include <pico/stdlib.h>
#include "hardware/pwm.h"
#include "hardware/adc.h"
#define LED_PIN_BUILT 25
#define DEFAULT_WRAP_PWM 4096
#define DEFAULT_DIV_PWM 3
"""
MIT License
Copyright (c) 2023 D. Sealtiel Valderrama
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
copies of the Software, and to permit persons to whom the Software is
@SealtielFreak
SealtielFreak / pong.py
Created September 19, 2023 20:18
Pong in Pygame
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import abc
import math
import functools
import pygame
import pygame.locals
import pygame.math