Skip to content

Instantly share code, notes, and snippets.

View bas-kirill's full-sized avatar
🎯
Focusing

kiryuxa bas-kirill

🎯
Focusing
View GitHub Profile
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.attribute.BasicFileAttributes
import kotlin.system.exitProcess
import kotlin.streams.toList
fun main(vararg args: String) {
val dir = try {
Path.of(args[0])
} catch (_: Exception) {
def main():
try:
checker = CompareChangesLib(
owner="your-github-owner",
repo="your-repo",
access_token="ghp_xxx",
local_repo_path=".",
branch_a="origin/main",
branch_b="my-feature-branch"
)
import subprocess
import json
import os
import sys
from typing import List, Set
import unittest
import requests
# if BUILD_ID is unset, compute metadata that will be used in builds
ifeq ($(strip $(BUILD_ID)),)
VCS_REF := $(shell git rev-parse --short HEAD)
BUILD_TIME_EPOCH := $(shell date +"%s")
BUILD_TIME_RFC_3339 := \
$(shell date -u -r $(BUILD_TIME_EPOCH) '+%Y-%m-%dT%I:%M:%SZ')
BUILD_TIME_UTC := \
$(shell date -u -r $(BUILD_TIME_EPOCH) +'%Y%m%d-%H%M%S')
BUILD_ID := $(BUILD_TIME_UTC)-$(VCS_REF)
endif
#!/usr/bin/env python3
import socket
from struct import pack
from time import sleep
# |--------------- UDP HEADER --------------|
# | SOURCE PORT | DESTINATION PORT | = 32 bits
# |--------------------|--------------------|
# | LENGTH | CHECKSUM | = 32 bits
# |-----------------------------------------|
@bas-kirill
bas-kirill / gist:a1b6d5c25ba3c0c5d22ae109f42306ca
Last active November 4, 2023 16:02
Send TCP RST with checksum
#!/usr/bin/env python3
import socket
from struct import pack
from time import sleep
#
# |--------------------|--------------------|
# | SOURCE PORT | DESTINATION PORT |
# |--------------------|--------------------|
# | SEQUENCE NUMBER |
import uuid
from django.db import models
from zero10.abstract_models import ModelWithCreatedAndUpdatedFields
class MLModel(ModelWithCreatedAndUpdatedFields):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(
package ru.tfs.concurrency.task2;
import java.util.concurrent.Exchanger;
import java.util.concurrent.locks.ReentrantLock;
public class AccountThread implements Runnable {
// private static final ReentrantLock lock = new ReentrantLock(true);
private static final Object lock = new Object();
private final Account accountFrom;
private final Account accountTo;
/home/eertree/.sdkman/candidates/java/17.0.1-tem/bin/java -javaagent:/snap/intellij-idea-community/345/lib/idea_rt.jar=35749:/snap/intellij-idea-community/345/bin -Dfile.encoding=UTF-8 -classpath /home/eertree/IdeaProjects/tinkoff/homework_2022/concurrency/target/classes ru.tfs.concurrency.task2.AccountMain
Transaction status: true
Cash balance of the first account: 99900
Cash balance of the second account: 100100
-----
Transaction status: true
Cash balance of the first account: 99800
Cash balance of the second account: 100200
-----
Transaction status: true
@bas-kirill
bas-kirill / event.proto
Created August 23, 2021 12:57
request ts
package NBifrost;
message TEvent {
optional string UserId = 1;
optional int64 EventType = 2;
optional int64 ItemType = 3;
optional sfixed64 ItemId = 4;
optional int64 Timestamp = 5;
optional int32 CountryGeoId = 6;
optional int64 VideoPositionSec = 7;