Skip to content

Instantly share code, notes, and snippets.

View ovechkin-dm's full-sized avatar
🎯
Focusing

ovechkin-dm

🎯
Focusing
View GitHub Profile
@ovechkin-dm
ovechkin-dm / gofuck.go
Last active July 11, 2021 19:53
Gofuck
package main
import (
"bufio"
"errors"
"fmt"
"io"
"strings"
)
class Solution {
public boolean searchMatrix(int[][] matrix, int target) {
int rows = matrix.length;
if (rows == 0) {
return false;
}
int cols = matrix[0].length;
if (cols == 0) {
return false;
}
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
)
package demo
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.server.Directives.{complete, pathPrefix}
import akka.http.scaladsl.server.Route
import akka.stream.ActorMaterializer
import monix.execution.Scheduler
import ru.tinkoff.tschema.akkaHttp.{MkRoute, RoutableIn, Serve}
import ru.tinkoff.tschema.swagger.Tag
@ovechkin-dm
ovechkin-dm / NES.py
Last active September 20, 2018 15:57
Natural Evolution Strategies Cartpole example
import gym
import numpy as np
import tensorflow as tf
state_dim = 4
action_dim = 2
population_size = 5
std = 0.1
alpha = 0.1
module Stepik () where
class (Enum a, Bounded a, Eq a) => SafeEnum a where
ssucc :: a -> a
ssucc x | x == maxBound = minBound
| otherwise = succ x
spred :: a -> a
spred x | x == minBound = maxBound
| otherwise = pred x
@ovechkin-dm
ovechkin-dm / J2DMrq.java
Last active September 2, 2015 13:26
2D MRQ
public class J2DMrq {
private int n;
private int[][] t = new int[0][0];
private int m;
public void build(int[][] arr) {
n = arr.length;
m = arr[0].length;
t = new int[n << 2][m << 2];
@ovechkin-dm
ovechkin-dm / gist:7b566ae66dca6f8832e9
Created February 24, 2015 09:40
Request get required parameters with shapeless
import scala.util.Try
import shapeless._
object ReqOps extends App {
trait ParamMapper[A <: HList, R <: HList] {
def map(hl: A): R
}
trait ParamChecker[A <: HList] {