Skip to content

Instantly share code, notes, and snippets.

View izeigerman's full-sized avatar

Iaroslav Zeigerman izeigerman

View GitHub Profile
@izeigerman
izeigerman / qqq.c
Last active January 31, 2019 03:30
#include <stdio.h>
#include <stdlib.h>
void foo(double *output) {
for(int i = 0; i < 10; ++i)
output[i] = i;
}
trait Flattanable[F[_]] {
def flatten[A](ff: F[F[A]]): F[A]
}
object Flattanable {
implicit def optionFlattanable: Flattanable[Option] = new Flattanable[Option] {
override def flatten[A](ff: Option[Option[A]]): Option[A] = ff match {
case Some(Some(v)) => Some(v)
case _ => None
}
class MyCircularDeque:
def __init__(self, k: int):
"""
Initialize your data structure here. Set the size of the deque to be k.
"""
self._capacity = k
self._size = 0
self._queue = [None] * self._capacity
self._head = None
class Solution:
def _bst_helper(self, root, lower, upper):
if root is None:
return True
def within_contstraints(val):
if lower is None and upper is None:
return True
if lower is None:
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def helper(self, root: TreeNode, k: int):
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def _helper(self, tree_root):
this_node = Node(tree_root.val)
class Solution:
def decodeString(self, s: str) -> str:
multipliers = []
sequences = []
last_multiplier = 0
last_sequence = ''
for c in s:
if c.isdigit():
class Solution:
def decodeString(self, s: str) -> str:
multipliers = []
sequences = []
last_multiplier = 0
last_sequence = ''
for c in s:
if c.isdigit():
@izeigerman
izeigerman / SseClient.scala
Last active December 3, 2021 07:49
Complete SSE client Implementation for Scala using http4s.
import cats.effect.{IO, Timer}
import fs2.{Pull, Stream}
import org.http4s._
import org.http4s.ServerSentEvent.EventId
import org.http4s.client.Client
import org.http4s.headers.{`Cache-Control`, Accept}
import scala.concurrent.duration._
import SseClient._
final class SseClient private (
import org.apache.spark.sql.DataFrame
case class AnnotatedDataFrame[D](toDF: DataFrame) extends Serializable