Skip to content

Instantly share code, notes, and snippets.

View M0nteCarl0's full-sized avatar
evolve or repeat

Alex M0nteCarl0

evolve or repeat
View GitHub Profile
@M0nteCarl0
M0nteCarl0 / async_message.go
Created October 18, 2023 18:52
golang async message processing
package main
import (
"fmt"
"time"
)
type MessageProcessor struct {
sendChannel chan<- string // Канал для отправки сообщений
receiveChannel <-chan string // Канал для приема сообщений
@M0nteCarl0
M0nteCarl0 / hset_sql_cache.go
Last active October 18, 2023 18:50
SQL requests_Redis cache
package cache
import (
"context"
"database/sql"
"encoding/json"
"fmt"
"time"
"github.com/go-redis/redis/v8"
@M0nteCarl0
M0nteCarl0 / backend.go
Last active March 29, 2024 09:18
Web socket notification receiver per user and backend server on golang
package main
import (
"log"
"net/http"
"time"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
)
@M0nteCarl0
M0nteCarl0 / Dask_distributed_catboost_learning.py
Last active October 9, 2023 05:32
Yndex Catboost summary cheatshit
from catboost import CatBoostClassifier
from dask_ml.model_selection import train_test_split
from dask.distributed import Client, wait
import dask.dataframe as dd
# Start a Dask cluster with multiple workers
client = Client(n_workers=4)
# Read the data into a Dask DataFrame
data = dd.read_csv('data.csv')
@M0nteCarl0
M0nteCarl0 / AVR_DCMI.c
Created August 8, 2023 14:32
DCMI inteface
#include <avr/io.h>
#include <avr/interrupt.h>
#define PIXEL_WIDTH 8
#define IMAGE_WIDTH 640
#define IMAGE_HEIGHT 480
volatile uint8_t pixel_count = 0;
volatile uint8_t line_count = 0;
volatile uint8_t frame_count = 0;
@M0nteCarl0
M0nteCarl0 / STM32F4_bootloader.icf
Created August 6, 2023 17:32
STM32F4 simple bootloader
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
@M0nteCarl0
M0nteCarl0 / Cubic_interp.cu
Created August 3, 2023 19:01
CUDA C linear & cubic interpolation kernels
__global__ void cubic_interp(float* x, float* y, int n, float* x_new, float* y_new, int m) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= m) return;
int i = 1;
while (i < n && x[i] <= x_new[idx]) {
@M0nteCarl0
M0nteCarl0 / Q&A.txt
Created August 3, 2023 18:49
Auriga 2023 Q&A
Q:
By default, Linux builds user-space programs as dynamically linked applications. Please describe scenarios where you would change the default behavior to compile your application as a statically linked one.
A:
There are several scenarios where you would change the default behavior to compile your application as a statically linked one:
1. Portability: If you want to ensure that your application will run on any system without having to worry about missing shared libraries or different versions of the same libraries, then compiling it statically is a good option.
2. Security: If you want to reduce the attack surface of your application by eliminating the need for external dependencies, then compiling it statically can help improve security.
3. Performance: If your application requires fast startup times and low memory usage, then compiling it statically can provide a performance boost since it eliminates the overhead of dynamic linking.
@M0nteCarl0
M0nteCarl0 / HistoryManager.cpp
Created August 3, 2023 09:12
HistoryManager
#include <iostream>
#include <fstream>
#include <vector>
#include <nlohmann/json.hpp>
using namespace std;
using json = nlohmann::json;
struct HistoryEntry {
std::string action;
@M0nteCarl0
M0nteCarl0 / meizu.cpp
Created August 3, 2023 08:38
Meizu project templates
#include <iostream>
#include <thread>
#include <vector>
#include <deque>
#include <mutex>
#include <condition_variable>
#include <boost/asio.hpp>
using boost::asio::ip::tcp;