Skip to content

Instantly share code, notes, and snippets.

View ezksd's full-sized avatar
🎯
Focusing

ezksd ezksd

🎯
Focusing
View GitHub Profile
package com.company;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
record Tuple<A,B>(A a,B b){}
interface Token { }
record Number(int i) implements Token{ }
@ezksd
ezksd / yiru.conf
Last active May 8, 2019 20:20
沙东人在纽约
[General]
bypass-system = true
skip-proxy = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,localhost,*.local,e.crashlynatics.com
bypass-tun = 0.0.0.0/8,1.0.0.0/9,1.160.0.0/11,1.192.0.0/11,10.0.0.0/8,14.0.0.0/11,14.96.0.0/11,14.128.0.0/11,14.192.0.0/11,27.0.0.0/10,27.96.0.0/11,27.128.0.0/9,36.0.0.0/10,36.96.0.0/11,36.128.0.0/9,39.0.0.0/11,39.64.0.0/10,39.128.0.0/10,42.0.0.0/8,43.224.0.0/11,45.64.0.0/10,47.64.0.0/10,49.0.0.0/9,49.128.0.0/11,49.192.0.0/10,54.192.0.0/11,54.191.0.0/16,58.0.0.0/9,58.128.0.0/11,58.192.0.0/10,59.32.0.0/11,59.64.0.0/10,59.128.0.0/9,60.0.0.0/10,60.160.0.0/11,60.192.0.0/10,61.0.0.0/10,61.64.0.0/11,61.128.0.0/10,61.224.0.0/11,100.64.0.0/10,101.0.0.0/9,101.128.0.0/11,101.192.0.0/10,103.0.0.0/10,103.192.0.0/10,106.0.0.0/9,106.224.0.0/11,110.0.0.0/7,112.0.0.0/9,112.128.0.0/11,112.192.0.0/10,113.0.0.0/9,113.128.0.0/11,113.192.0.0/10,114.0.0.0/9,114.128.0.0/11,114.192.0.0/10,115.0.0.0/8,116.0.0.0/8,117.0.0.0/9,117.128.0.0/10,118.0.0.0/11,118.64.0.0/10,118.128.0.0/9,119.0.0.0/9,119.128.0.0/10,119.224
module Parser where
import Control.Applicative
import Control.Monad
import Control.Monad.Trans.State
import Data.Char
type Parser a = StateT String Maybe a
runParse :: Parser a -> String -> Maybe a
runParse p s = do (a,b) <- runStateT p s
@ezksd
ezksd / Interpreter.scala
Created March 11, 2017 09:05
interpreter
package ezksd
import ezksd.Parser.parse
object Interpreter {
type Continuation[T] = T => Unit
@inline
def cps_map(l: List[Any], f: (Any, Any => Unit) => Unit, k: Continuation[List[Any]]) {
import java.util.function.Function;
import java.util.function.Supplier;
interface TailRec<A> {
default <B> TailRec<B> map(Function<A, B> f) {
return flatmap(x -> new Call<>(() -> new Done<>(f.apply(x))));
}
default <B> TailRec<B> flatmap(Function<A, TailRec<B>> f) {
if (this instanceof Done) {
import java.util.function.Function;
import java.util.function.Supplier;
interface TailRec<A> {
default <B> TailRec<B> map(Function<A, B> f) {
return flatmap(x -> new Call<>(() -> new Done<>(f.apply(x))));
}
default <B> TailRec<B> flatmap(Function<A, TailRec<B>> f) {
if (this instanceof Done) {
@ezksd
ezksd / Lazy.java
Last active February 17, 2017 01:46
import java.util.function.Supplier;
public interface Lazy<T> extends Supplier<T> {
static <T> Lazy<T> of(Supplier<T> sup) {
return new LazyImpl<T>(sup);
}
static <T> Lazy<T> ofSafe(Supplier<T> sup) {
return new LazyThreadSafe<T>(sup);
import java.util.function.Supplier;
public interface Lazy<T> extends Supplier<T> {
static <T> Lazy<T> of(Supplier<T> sup) {
return new LazyImpl<T>(sup);
}
static <T> Lazy<T> ofSafe(Supplier<T> sup) {
return new LazyThreadSafe<T>(sup);
import java.util.function.Supplier;
public interface Lazy<T> extends Supplier<T> {
static <T> Lazy<T> of(Supplier<T> sup) {
return new LazyImpl<T>(sup);
}
static <T> Lazy<T> ofSafe(Supplier<T> sup) {
return new LazyThreadSafe<T>(sup);
import java.util.function.Supplier;
public interface Lazy<T> extends Supplier<T> {
static <T> Lazy<T> of(Supplier<T> sup) {
return new LazyImpl<T>(sup);
}
static <T> Lazy<T> ofSafe(Supplier<T> sup) {
return new LazyThreadSafe<T>(sup);