Skip to content

Instantly share code, notes, and snippets.

View SealtielFreak's full-sized avatar
🌴
On vacation

SealtielFreak SealtielFreak

🌴
On vacation
View GitHub Profile
from abc import ABC, abstractmethod
from typing import Generic, TypeVar, Type, Callable, Union, Dict
C = TypeVar('C')
class DefineClassDerivative(Generic[C]):
def __init__(self, define: str):
def empty_init(*args, **kwargs):
@SealtielFreak
SealtielFreak / snakey2d.py
Last active January 7, 2023 02:13
snakey2d is a small and experimental game framework for Python (Byrthon and Pyscript)
"""
MIT License
Copyright (c) 2022 SealtielFreak
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
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@SealtielFreak
SealtielFreak / JDoubleBuffered.java
Last active December 24, 2022 21:47
BasicGraphics in Java
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
public class JDoubleBuffered extends JFrame {
void loop() throws Exception {
boolean isRunning = true;
def count_bits(number):
bit = 1
i = 0
while True:
if bit > n:
return i
bit += bit
i += 1
@SealtielFreak
SealtielFreak / terminal.py
Last active December 27, 2022 07:57
terminal.py is a library for interactive terminal in brython or cpython
"""
MIT License
Copyright (c) 2022 SealtielFreak
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
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
require 'benchmark'
require 'matrix'
module Color
def self.from_i(c, c_map = [16, 8, 0])
c_map.map { |i| ((c >> i) & 0xFF) }
end
def self.from_rgb(c)
'0x' + c.map { |i|
#!/usr/bin/env jruby
require 'java'
require 'set'
require 'singleton'
java_import java.awt.Color
java_import java.awt.Dimension
java_import java.awt.FlowLayout
java_import java.awt.GridLayout
#!/usr/bin/jruby
require 'java'
require 'set'
require 'singleton'
java_import java.awt.Color
java_import java.awt.Dimension
java_import java.awt.FlowLayout
#ifndef CONIO_H
#define CONIO_H
struct text_info {
unsigned char curx, cury;
unsigned short attribute, normattr;
unsigned char screenwidth, screenheight;
};
struct char_info {
@SealtielFreak
SealtielFreak / functor.cpp
Created May 28, 2022 16:49
Functor in CPP
template<typename R, typename ...Args>
class Functor {
protected:
virtual R call(Args ...args) = 0;
public:
R operator()(Args ...args) {
return call(args...);
}
};