Skip to content

Instantly share code, notes, and snippets.

Ping me if you think I forget about the issues 😈

Alisue lambdalisue

Block or report user

Report or block lambdalisue

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Cancellation.vim
let s:SYMBOL = '@@cancelSignal'
function! s:_vital_created(module) abort
let a:module.Symbol = s:SYMBOL
function! s:cancelable() abort
let subscribers = []
let signal = {
\ 'signaled': v:false,
lambdalisue / List.vim
Created Dec 10, 2018
compare old/new
View List.vim
let s:Benchmark = vital#vital#import('Vital.Benchmark')
let s:Old = vital#vital#import('Data.List')
let s:New = vital#vital#import('Vital.List')
function! s:map() abort
let list = repeat(['hello'], 1000)
echo 'map()'
echo printf(
\ ' Old: %f sec',
\ s:Benchmark.timeit({ ->, { v -> toupper(v) }) })
lambdalisue / task.json
Last active Dec 4, 2018
scoop manifest for go-task/task
View task.json
"homepage": "",
"description": "A task runner / build tool that aims to be simpler and easier to use",
"license": "MIT",
"version": "v2.2.0",
"architecture": {
"64bit": {
"url": "",
"hash": "1fd06172c7ee66529dd8cb1709083b863713d01317be55f978aac8039a290c8c"
View test.vim
let s:n = 10000
let s:data = repeat(["Hello World\r"], s:n)
let s:expect = repeat(['Hello World'], s:n)
function! s:validate(data) abort
for i in range(len(s:expect))
if a:data[i] !=# s:expect[i]
echoerr printf('%d: %s != %s', i, a:data[i], s:expect[i])
lambdalisue /
Created May 16, 2018
synping which works on BSD (macOS) as well (fix ip_len byteorder issue)
import socket
import random
import platform
from dpkt.tcp import TCP, TH_SYN
if platform.system() in ('FreeBSD', 'Darwin'):
# > Before FreeBSD 10.0 packets received on raw IP sockets had the ip_hl sub-
View Executor.vim
function! s:_vital_loaded(V) abort
let s:Job = a:V.import('System.Job')
let s:Promise = a:V.import('Async.Promise')
function! s:_vital_depends() abort
return ['System.Job', 'Async.Promise']
lambdalisue /
Created Mar 13, 2018
Play with asyncio cancelleration
import asyncio
from contextlib import suppress
def describe(t: asyncio.Future):
return 'Done: %s, Cancel: %s' % (t.done(), t.cancelled())
async def raise_exception(n):
await asyncio.sleep(n)
lambdalisue / test.vim
Created Mar 6, 2018
Interactive input() in simple way (Vim)
View test.vim
let s:UNIQUE = sha256(expand('<sfile>'))
function! s:iinput(callback, prompt, ...) abort
let text = a:0 > 0 ? a:1 : ''
let comp = a:0 > 1 ? a:2 : v:null
let exit = 0
let previous = ''
execute printf('cnoremap <buffer> <CR> %sCR<CR>', s:UNIQUE)
execute printf('cnoremap <buffer> <Esc> %sESC<CR>', s:UNIQUE)
lambdalisue /
Created Feb 19, 2018
Ctrl+C hotfix patch of asyncio on Windows
import asyncio
import sys
# Ctrl-C (KeyboardInterrupt) does not work well on Windows
# This module solve that issue with wakeup coroutine.
if sys.platform.startswith('win'):
def hotfix(loop: asyncio.AbstractEventLoop) -> asyncio.AbstractEventLoop:
loop.call_soon(_wakeup, loop, 1.0)
return loop
lambdalisue / test.vim
Created Jan 29, 2018
system() by System.Job
View test.vim
let s:Job = vital#vital#import('System.Job')
function! s:_on_stdout(data) abort dict
let self.stdout[-1] .= a:data[0]
call extend(self.stdout, a:data[1:])
function! s:_on_stderr(data) abort dict
let self.stderr[-1] .= a:data[0]
call extend(self.stderr, a:data[1:])
You can’t perform that action at this time.