Skip to content

Instantly share code, notes, and snippets.

import java.util.Map;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;
public class ReservedCacheSceme<K, V> {
private final V reserved;
private final Map<K, V> cache = new ConcurrentHashMap<>();
from typing import List
def create_adj_list(n: int, el: List[List[int]]) -> List[List[int]]:
adj = [[] for _ in range(n)]
for e in el:
adj[e[0]].append(e[1])
return adj
@rasouli
rasouli / tmux-cheatsheet.markdown
Created April 26, 2020 13:40 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@rasouli
rasouli / glips.yml
Created July 3, 2019 14:43
Building clips from source and generating go binding
GENERATOR:
PackageName: glips
PackageDescription: "Package glips provides Go bindings for clips"
PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS."
Includes: ["clips.h"]
PARSER:
IncludePaths: ["clips_core_source_630/core", "/usr/include"]
SourcesPaths: ["clips_core_source_630/core/clips.h"]
@rasouli
rasouli / build_docker_client.sh
Created August 23, 2017 17:58
installing docker client while the process of renaming "docker/docker" to "moby/moby" import path is in progress.
# while import path in docker project is being renamed to moby/moby,
# I had trouble installing/building moby client. I faced the following error on issuing
# $ go install
# command inside $GOPATH/src/github.com/moby/moby/client:
# ./service_create.go:96: cannot use distributionInspect.Descriptor.Digest (type "github.com/docker/docker/vendor/github.com/opencontainers/go-digest".Digest) as type "github.com/moby/moby/vendor/github.com/opencontainers/go-digest".Digest in argument to imageWithDigestString
# the workaround I found for time being is the following which helped me to compile the docker/moby client
# library, hope it comes useful.
# in order issue following command or similar for your platform:
# 1- issue go get to get the packages ( ignore the "no buildable Go source files in" error in the end)
Welcome to Scala version 2.11.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_67).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import akka.actor._
import akka.actor._
scala> val system = ActorSystem("hoge")
system: akka.actor.ActorSystem = akka://hoge