This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert_file_to_header(input_file, output_header, variable_name): | |
with open(input_file, 'rb') as f: | |
data = f.read() | |
with open(output_header, 'w') as h: | |
h.write(f"#ifndef FILE_{variable_name.upper()}_H_INCLUDED\n") | |
h.write(f"#define FILE_{variable_name.upper()}_H_INCLUDED\n\n") | |
h.write(f"// Generated from {input_file}\n\n") | |
h.write(f"const unsigned char {variable_name}[] = {{\n") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <stdio.h> | |
#include <string> | |
#include <ostream> | |
#define HG_CLEAR printf("\033[2J") | |
#define HG_GOTO_START printf("\033[H") | |
#define HG_GOTO(row, col) printf("\033[%d;%dH", (row), (col)) | |
#define HG_GOTO_LINE(line) printf("\033[%d;0H", (line)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
/* | |
* Scoped Timer 1.1 | |
* by Hegemon Studio | |
* | |
* used for profiling | |
* speed measure (in millis) | |
* | |
* easy header-only library |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
bool is_prime(unsigned long long n) { | |
if (n <= 1) return false; | |
if (n == 2) return true; | |
if (n % 2 == 0) return false; | |
for (int i = 3; i * i <= n; i += 2) | |
if (n % i == 0) return false; | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
dictionaries: dict[str, str] = { | |
"pl": "https://raw.githubusercontent.com/sigo/polish-dictionary/master/dist/pl.txt", | |
"en": "https://raw.githubusercontent.com/dwyl/english-words/master/words.txt", | |
} | |
_7seg_possible_chars: str = "0123456789abcdefhijlnoprstuy" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.constants import G | |
# F = G * (M1 * M2 / r2) | |
M1 = 1 | |
F = 9.81 | |
r = 6_371_000 | |
# M2 = F * r2 / G / M1 | |
M2 = F * pow(r, 2) / G / M1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef VEC_HPP_INCLUDED | |
/* | |
Author: Tymon Woźniak <https://github.com/Moderrek> | |
Vector Array implementation in C++ by Tymon Woźniak | |
*/ | |
#define VEC_HPP_INCLUDED | |
#include <iostream> | |
#include <string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Tymon Woźniak <https://github.com/Moderrek> | |
C compile time concatenation | |
Struct printf | |
*/ | |
#include <stdio.h> | |
// struct print format | |
#define Point_Fmt "(%d, %d)" | |
// unpack struct |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import os | |
import mimetypes | |
class TCPServer: | |
def __init__(self, host='127.0.0.1', port=8888): | |
self.host = host | |
self.port = port |