Skip to content

Instantly share code, notes, and snippets.

View sunmeat's full-sized avatar
🐈
MEOW

Oleksandr Zahoruiko sunmeat

🐈
MEOW
View GitHub Profile
from typing import Protocol, runtime_checkable
import requests
from random import uniform
@runtime_checkable
class TemperatureSensor(Protocol):
def read_temperature(self) -> float:
"""Повертає поточну температуру в градусах Цельсія"""
...
def get_sensor_id(self) -> str:
from .account import BankAccount
__all__ = ['BankAccount']
@sunmeat
sunmeat / task.md
Last active April 10, 2026 08:44
ДЗ гороскоп

🌟 Програма «Гороскоп на сьогодні та завтра»

Мова програмування: C++
Тип програми: Консольна

Опис завдання

Написати консольну програму, яка дозволяє користувачеві обрати знак зодіаку та отримати гороскоп на сьогодні та на завтра.

Основна функціональність

@sunmeat
sunmeat / main.cpp
Created April 10, 2026 05:24
cpp console app and php integration (http example) mac os version
# треба встановити curl (якщо ще немає)
brew install curl
# якщо немає Homebrew - спочатку треба встановити його:
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
======================================================================================================================
#include <iostream>
#include <string>
@sunmeat
sunmeat / client.cpp
Created April 7, 2026 15:57
приклад на парі 07.04.2026
#define WIN32_LEAN_AND_MEAN
#include <iostream>
#include <ws2tcpip.h>
using namespace std;
#pragma comment (lib, "Ws2_32.lib")
#pragma comment (lib, "Mswsock.lib") // AcceptEx(), ConnectEx(), WSASendMsg() тощо
#pragma comment (lib, "AdvApi32.lib") // Security API, Registry API, Service Control Manager тощо
@sunmeat
sunmeat / main.cpp
Created April 3, 2026 05:30
get file from hosting mac os version
#include <iostream>
#include <string>
#include <curl/curl.h>
using namespace std;
size_t write_data(void* ptr, size_t size, size_t nmemb, FILE* stream) {
return fwrite(ptr, size, nmemb, stream);
}
@sunmeat
sunmeat / main.cpp
Created April 3, 2026 05:27
get html page text C++ example HTTP GET mac os version
#include <iostream>
#include <string>
#include <cstring>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
using namespace std;
int main() {
string url = "google.com";
@sunmeat
sunmeat / different files.kt
Created March 29, 2026 11:33
jetpack compose example
build.gradle.kts (Project):
plugins {
alias(libs.plugins.android.application) apply false
kotlin("plugin.compose") version "2.0.21" apply false // !!!
}
==================================================================================================================
build.gradle.kts (Module:app):
#define WIN32_LEAN_AND_MEAN
#include <ws2tcpip.h>
#include <windows.h>
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <chrono>
#include <thread>
@sunmeat
sunmeat / different files.cpp
Created March 27, 2026 09:04
one server multiple clients C++ example (UDP) mac os version
SERVER SIDE:
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>