Skip to content

Instantly share code, notes, and snippets.

View nikochiko's full-sized avatar
🎯
Focusing

Kaustubh Maske Patil nikochiko

🎯
Focusing
View GitHub Profile
module ThreadMetadata : sig
type t
val create : unit -> t
val get_insert_count : t -> int -> int (* t -> thread ID -> insert count *)
val get_delete_count : t -> int -> int (* t -> thread ID -> delete count *)
val update_insert_count : t -> int -> int -> unit (* t -> thread ID -> old insert count -> () *)
val update_delete_count : t -> int -> int -> unit (* t -> thread ID -> old delete count -> () *)
val get_sum : t -> int
end = struct
module ThreadMetadata : sig
type t
val create : unit -> t
val get_insert_count : t -> int -> int
val get_delete_count : t -> int -> int
val update_insert_count : t -> int -> int -> unit
val update_delete_count : t -> int -> int -> unit
val get_sum : t -> int
end = struct
@nikochiko
nikochiko / regex.py
Last active December 3, 2022 21:38
Regex FSM example
from __future__ import annotations
from dataclasses import dataclass
@dataclass
class State:
transitions: dict[str, State]
def transition(self, input):
@nikochiko
nikochiko / catcher.py
Created September 19, 2022 11:05
Mailcatcher
from email.generator import Generator
from email.parser import Parser
from aiosmtpd.handlers import Message
class MailFile(Message):
def __init__(self, mail_file, message_class=None):
self.mail_file = mail_file
super().__init__(message_class=None)
call plug#begin('~/.vim/plugged')
Plug 'dracula/vim'
Plug 'kyazdani42/nvim-web-devicons' " for file icons
Plug 'kyazdani42/nvim-tree.lua'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
@nikochiko
nikochiko / dummy
Created January 2, 2020 09:17
Dummy Binary File
Dummy File Content
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
self.CHALLENGE_DATA_DIR = join(
self.BASE_TEMP_DIR, "compute/challenge_data/challenge_{challenge_id}"
)
self.PHASE_DATA_DIR = join(
self.CHALLENGE_DATA_DIR, "phase_data/phase_{phase_id}"
)
self.CHALLENGE_IMPORT_STRING = "challenge_data.challenge_{challenge_id}"
def get_phase_annotation_file_path(
self,
challenge_id,
phase_id,
annotation_file):
"""Helper Method: Takes `challenge_id`, `phase_id` and `annotation_file`
as input and returns corresponding path to annotation file"""
annotation_file_name = os.path.basename(annotation_file.name)
return join(self.PHASE_DATA_DIR, "{annotation_file}").format(
@nikochiko
nikochiko / evolutionary-algos-simple-2.py
Created September 2, 2019 10:04
Evolutionary-algos-simple-out
[[0.0024761009000009437, -2.99753],
[0.006177699600002029, -2.99386],
[0.008496555099998915, -3.99143],
[0.00997839359999908, -3.98992]]