Skip to content

Instantly share code, notes, and snippets.

View Colk-tech's full-sized avatar
😇
Over-working

ITO Manaki (Colk) Colk-tech

😇
Over-working
View GitHub Profile
@Colk-tech
Colk-tech / mag.py
Created February 26, 2024 11:44
Show all possible magnitude relationships
import itertools
from typing import Union
SYMBOLS: list[str] = ["p", "q", "r", "s"]
if __name__ == "__main__":
for number_of_equals in range(0, len(SYMBOLS)):
for equal_combination in map(
lambda x: list(x), itertools.combinations(SYMBOLS, number_of_equals)
):
@Colk-tech
Colk-tech / check.py
Last active October 20, 2023 06:10
Pygame samples
import pygame
def main() -> None:
pygame.init()
print("Checking number of joysticks...")
print(f"{pygame.joystick.get_count()} joystick(s) found.")
joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())]
@Colk-tech
Colk-tech / bis.c
Created October 13, 2023 03:07
Bisection method for equations
#include <stdio.h>
#include <math.h>
double f(double x) {
double result = (x * x * x) - (3 * x) - 1;
return result;
}
@Colk-tech
Colk-tech / newton.c
Last active October 13, 2023 03:07
Newton's method for equations
#include <stdio.h>
#include <math.h>
#define MAX 20
int main(void) {
int i;
double x0, x1, fx0, dfx0, eps = 0.0001;
printf("x0 = ");
@Colk-tech
Colk-tech / colk-rsa.pub
Created August 29, 2023 13:49
Colk's SSH Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCyvwVApMwPK6DXN7x6nBFe907HA2HkIjMmcuGdUWg4DCW3lmfLXl5MKtPLEGeSfyJ8CeE1c4EVDGWIX9q/pYZA74VWycZ1IY+Sy1E8l8z82tczzetfxDbBahoPqLfADHyI1or70Vg3Eu/xTT/TmU0R4gRL/uw1oCzpcF5TwC6Rrn1F/zklz2GMJs1F9S8VL5xepufZz5V04PXanXu703MiJQjK1i+aFN5WEE4jN5kdxO9n5ZEadFcGGjEI/QLSMtHGCl3cza2keXpy+0ujxVYvovZiE3RWimAwnkBoNBJ89o4LWTU6ICnqdiRXz9rnKC/5bwkNVLv21Le26F+RUvJZrURQ18D1PI2+ApEF33Qps7aMsHtuDRaETAigXTG+HZX7U8OrfwddTKJA11yNH3SZjUJpsTNX2Tzr7nK3U70yaO8JUUNehbfDtBS2zTQ9jPmSJQ2AGOyRLysqgSOicBWTOLvkZNJFg/QQq0FnixAOi9raF5dtciQkR76pyoAQXpSRP2zLlVZV8RvZF0vTUDVUz44dn5wfl5+Z9NazH7Qs0wi1/+MxbpIIVKfJkKu3fBSoDQAFxNOnV0m0O5wCMxbEi3ynaCiTQyyjoFXbuEBQ6GqBHQ4q9yLmffdwAC/6AgiAhLxHdZQFyR/X50KO4A9dyI90X0S5iF8xf72OBb1Fkw== Colk-tech
@Colk-tech
Colk-tech / id_pair.py
Last active April 2, 2023 13:45
UUID -> docsid converter written in Python
from sqlalchemy import Column, String
from models.types.uuid import UUIDColumn
from models.mixin.timestamp import TimeStampMixin
from db import Base
class IDPair(Base, TimeStampMixin):
__tablename__: str = "documents"
@Colk-tech
Colk-tech / exams.csv
Last active November 13, 2022 14:16
Data used for the class "Statistical Analysis Methods" held in NIT, Ibarak College. Originally from http://roycekimmons.com/tools/generated_data/exams
gender race/ethnicity parental level of education lunch test preparation course math score reading score writing score
male group C associate's degree free/reduced completed 64 60 57
male group C some college free/reduced none 77 78 73
female group D master's degree free/reduced none 77 89 91
female group B some college standard none 85 88 89
female group C associate's degree standard none 64 66 66
male group B bachelor's degree free/reduced none 35 38 29
male group B master's degree free/reduced none 66 69 59
female group D master's degree standard none 64 85 79
female group B high school standard none 47 55 60
@Colk-tech
Colk-tech / colk_conoha.pub
Created October 22, 2022 15:22
Colk SSH Public Keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDIyoAbI0HwBCAS5oVElQij4ZMSNpwA2qOyxl8eYg6k4Lxf6QLTJSBIy4cAut4dv6qBFlRmbNnuI2mEeqXtBuqwmm0HDmU+D89kuWnHfZGi+lM9uEuE8M1tVCr/jqcx5mk7dx4dlEGRYdPzVMP0VjjdvVkpdRWVlF4UPKP7pRhtuCz9ZYWjwA1QIXnXT1fgjybqTSsMewiOgsBZgnfR64UUXjRM1wLbY2XxzPKmdi78zgfQY2WC6KDmjjK6x65jSgOqcnIxwElUpdtVIVBhswwu5XJFlUXdC11FT58nHpmJL7j+8lFPx4W3Iv6VpFjYVIdx9YgFDoOywTPoFDw4oopwirtjVJvRBsMoNX8nDn4lxRxlxGyvThjd0gqPqxVVnzGM0IxMW3oqO6xrOr05w97EzNLuLEhJ6duQWpAf7qmcNaNClKC8xCrQ1fxBXeFxlcu2iNHzCOkYL9iscLhbwlTTHwpCHIHFec2amVXcYPcAdoEzfqKJDiFNxc+31Aaz9GY9xPwNewU9O2rr4GhYpNNmVSN7CMT9Kbe0bpc0K08swy/j+Fdcnh2sIoRPedV5EahttUophZXu0zCaLxqGb7uRPJYzN3cLx7Ql1Vhhi6DpMqPjv5FkBSWPzMmojLNBMo+fgzOpM1Vh5HexAxCWE+TWlXUTplTRVB7hVSqJBzFiWw== iam@colk.dev
#!/usr/bin/perl
$title = "Hello!";
$body = "Hello, World from Perl.¥n"; print << "EOT";
Content-Type: text/html
<html> <head><title>$title</title></head> <body>
$body
</body>
</html>
@Colk-tech
Colk-tech / generate_django_secret.py
Last active March 3, 2022 10:57
A Python script generates secret key of Django with specified length
from django.utils.crypto import get_random_string
def get_random_specified_length_secret_key(length: int) -> str:
"""
Return a random string with specified length usable as a SECRET_KEY setting value.
"""
chars = "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)"
return get_random_string(length, chars)