Skip to content

Instantly share code, notes, and snippets.

View iseki0's full-sized avatar
😇
kill me, please.

iseki iseki0

😇
kill me, please.
View GitHub Profile
@iseki0
iseki0 / code.kt
Last active April 21, 2018 07:27
Kotlin internal error...
fun main(args:Array<String>){
val a=IntRange(0,3)
val s="0123456"
println(s.substring(a))
while(true){} // <<<----- BUG !!!
}
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
This key has been revoke!
I lost all secret key.(Except encrypt and signature key which is in yubikey.)
I cannot generate a revocation.
iseki
2019/6/21
-----BEGIN PGP SIGNATURE-----
@iseki0
iseki0 / keybase.md
Created August 11, 2019 09:31
KEYBASE Auth.

Keybase proof

I hereby claim:

  • I am cpdyj on github.
  • I am iseki (https://keybase.io/iseki) on keybase.
  • I have a public key ASCnrr1PRCnVZFjg0wmSa2D2lABjiVq7Ju4yZNhwU9MwmQo

To claim this, I am signing this object:

@iseki0
iseki0 / RingBuffer.kt
Created November 18, 2019 07:57
RingBuffer.kt
class RingBuffer<T:Any>(val size:Int){
init {
check(size>-1)
}
private var putptr=0
private var getptr=0
private var free=size
private val array= arrayOfNulls<Any>(size)
fun put(o:T){
if (free==0){
@iseki0
iseki0 / gist:9fd3669da725f8e2ace68d10bdac9b16
Last active February 2, 2020 11:59
Aria2 批量保留路径工具
package bot
import org.apache.commons.codec.net.URLCodec
import java.io.FileReader
import java.io.FileWriter
import java.net.URL
fun main() {
// 输入为 find 命令的输出去掉首行
@iseki0
iseki0 / pinyin-notice.txt
Last active January 19, 2020 14:56
汉字拼音json
All data from: github.com/overtrue/pinyin
by MIT license
thanks.
@iseki0
iseki0 / slice.kt
Created February 13, 2020 08:17
kotlin slice with default and negative index
internal fun <T> List<T>.slice(indices: Iterable<Int>, default: (index: Int) -> T): List<T> {
fun measureSizeOrDefault(iterator: Iterable<Int>, defaultValue: Int): Int =
when (iterator) {
is IntProgression -> {
iterator.run {
when {
step > 0 -> if (first > last) 0 else ((last - first) / step) + 1
step < 0 -> if (last > first) 0 else ((first - last) / step.absoluteValue) + 1
else -> error("step equals zero.")
}
@iseki0
iseki0 / slice.kt
Last active February 13, 2020 09:07
kotlin slice with default and negative index
internal fun <T> List<T>.slice(indices: Iterable<Int>, default: (index: Int) -> T): List<T> {
val size = indices.measureSizeOrDefault(10)
val target = ArrayList<T>(size)
val availRange = 0..this.lastIndex
indices.forEach {
val pos = if (it < 0) this.size + it else it
if (pos in availRange) {
target.add(this[pos])
} else {
target.add(default.invoke(pos))
@iseki0
iseki0 / a.js
Created April 17, 2020 13:39
微信小程序圆环
c:{
c0:0,
c1:0,
mh:false
}
function uc(page,x){
const c={
c:{
c0:x<0.5?x:0.5,
plugins {
java
kotlin("jvm") version "1.4-M1"
application
}
group = "space.iseki"
version = "1.0-SNAPSHOT"