This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def rand(low, up): | |
if low < up: | |
return rand(up, low) | |
return low + random.random()*(up-low) | |
def sample(m, n): | |
low = 1 | |
upper = m * 0.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import static com.google.common.base.Preconditions.checkArgument; | |
public final class PgArrayUtils { | |
private PgArrayUtils() { | |
} | |
public static List<Long> parseLongArray(String text) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package xyz.krkw.grpc.demo; | |
import org.junit.Test; | |
import java.util.ArrayList; | |
import java.util.concurrent.Semaphore; | |
import java.util.concurrent.atomic.AtomicInteger; | |
/** | |
* Copyright © Liu Xiao, 2019 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source = """ | |
{ | |
"root1" | |
{ | |
"item1" "1" | |
"item2" "abc" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# helper class | |
class C: | |
def __init__(self, val): | |
self.val = val | |
def pipe(self, func): | |
return C(func(self.val)) | |
def result(self): | |
return self.val | |
__getitem__ = pipe | |
__call__ = result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo defaults delete /Library/Preferences/com.apple.windowserver.plist DisplayResolutionEnabled | |
sudo /Library/Application\ Support/VMware\ Tools/vmware-resolutionSet 1920 1080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int reverce_number(int v) { | |
int rv = 0, remainder; | |
for (; v != 0; remainder = v % 10, v /= 10, rv = rv * 10 + remainder) /* nothing */; | |
return rv; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fibs = 1:1:zipWith (+) fibs (tail fibs) | |
fib n = fibs !! n |