Skip to content

Instantly share code, notes, and snippets.

View eupp's full-sized avatar

Evgeniy Moiseenko eupp

  • JetBrains Research
View GitHub Profile
@eupp
eupp / state.hs
Created December 21, 2016 15:54
Monad Transformer Example
module Main (comp2, main) where
import Data.Maybe
import Data.List
import Data.Functor
import Control.Applicative
import Control.Monad
type Env a = [(String, a)]
@eupp
eupp / csc-nlp-hw1
Created September 20, 2017 00:34
csc-nlp-hw1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Домашнее задание #1
К сожалению, у нас нет "истинных" "наиболее описательных" слов для датасета.
В этом задании от вас требуется
1) задать правильную формулу TF.IDF в функции calc_token_weight,
2) передать в неё правильные параметры.
all:
ocamlfind opt -g -rectypes -syntax camlp5o -package ocanren,ocanren.syntax,GT,GT.syntax.all -linkpkg -o poly poly.ml
clean:
rm *.cm[oix] *.o poly
# Uses python3
import sys
import math
# W - вместимость рюкзака
# w - набор весов
def optimal_weight(W, w):
n = len(w)
table_res = [[math.inf for x in range(0, n+1)] for y in range(0, W+1)]
for i in range(n + 1):
def fuck(n):
A = [0] * (n+1)
B = [-1] * (n+1)
for i in range(2, n+1):
A[i] = A[i - 1]
B[i] = i-1
if i % 2 == 0 and A[int(i / 2)] < A[i]:
A[i] = A[int(i / 2)]
B[i] = int(i / 2)
@eupp
eupp / Makefile
Created April 18, 2018 11:36
PBE demo using OCanren
.PHONY: all pbe clean
all: pbe
clean:
rm pbe *.cmi *.cmx *.o
pbe:
ocamlfind opt -g -rectypes -syntax camlp5o -package ocanren,ocanren.syntax -linkpkg -o pbe pbe.ml
@eupp
eupp / dune
Created December 25, 2019 00:13
Demo of OCanren's reifiers without modules
; to build the demo type
; 1) `opam install dune`
; 2) `dune exec ./main.exe`
(executable
(name main)
(flags (:standard -rectypes -warn-error -A -w -K-9-27))
)
@eupp
eupp / Styleguide.md
Created March 23, 2020 15:43
Coq styleguide for the semantics course homework assignments

Code Style Guide

Naming conventions

  • Prefer snake_case for the names of function arguments, inductive datatypes, definitions, and lemmas.

  • Prefer CamelCase for the names of hypothesis, variables inside sections, modules, and sections.

Module Foo.
@eupp
eupp / Atomics.java
Created August 22, 2023 13:20
Java Atomics API example
package org.example;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.util.concurrent.atomic.AtomicInteger;
public class Main {
static class Holder {
public volatile int atomic = 0;
@eupp
eupp / atomics.ll
Last active August 22, 2023 15:52
LLVM Atomic instructions example
store atomic i32 1, ptr %ptr, seq_cst, align 4
store atomic i32 2, ptr %ptr, release, align 4
store atomic i32 3, ptr %ptr, monotonic, align 4
store atomic i32 4, ptr %ptr, unordered, align 4
store i32 5, ptr %ptr, align 4 ;; NotAtomic
...
%r1 = load atomic i32, ptr %ptr, seq_cst, align 4
%r2 = load atomic i32, ptr %ptr, release, align 4
%r3 = load atomic i32, ptr %ptr, monotonic, align 4
%r4 = load atomic i32, ptr %ptr, unordered, align 4