Skip to content

Instantly share code, notes, and snippets.

🇯🇵
Ping me if you think I forget about the issues 😈

Alisue lambdalisue

🇯🇵
Ping me if you think I forget about the issues 😈
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
@lambdalisue
lambdalisue / iceberg.itermcolors
Created Jul 4, 2019
iTerm2 color presets for cocopon/iceberg.vim
View iceberg.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.12941176470588237</real>
View Cancellation.vim
let s:SYMBOL = '@@cancelSignal'
function! s:_vital_created(module) abort
let a:module.Symbol = s:SYMBOL
endfunction
function! s:cancelable() abort
let subscribers = []
let signal = {
\ 'signaled': v:false,
@lambdalisue
lambdalisue / List.vim
Created Dec 10, 2018
compare old/new vital.data.list
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({ -> s:OldList.map(list, { v -> toupper(v) }) })
@lambdalisue
lambdalisue / task.json
Last active Dec 4, 2018
scoop manifest for go-task/task
View task.json
{
"homepage": "https://taskfile.org",
"description": "A task runner / build tool that aims to be simpler and easier to use",
"license": "MIT",
"version": "v2.2.0",
"architecture": {
"64bit": {
"url": "https://github.com/go-task/task/releases/download/v2.2.0/task_windows_amd64.zip",
"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])
endif
endfor
@lambdalisue
lambdalisue / synping.py
Created May 16, 2018
synping which works on BSD (macOS) as well (fix ip_len byteorder issue)
View synping.py
import socket
import random
import platform
from dpkt.tcp import TCP, TH_SYN
print(platform.system())
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')
endfunction
function! s:_vital_depends() abort
return ['System.Job', 'Async.Promise']
endfunction
@lambdalisue
lambdalisue / async_test.py
Created Mar 13, 2018
Play with asyncio cancelleration
View async_test.py
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
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)
try
@lambdalisue
lambdalisue / windows.py
Created Feb 19, 2018
Ctrl+C hotfix patch of asyncio on Windows
View windows.py
import asyncio
import sys
# Ctrl-C (KeyboardInterrupt) does not work well on Windows
# This module solve that issue with wakeup coroutine.
# https://stackoverflow.com/questions/24774980/why-cant-i-catch-sigint-when-asyncio-event-loop-is-running/24775107#24775107
if sys.platform.startswith('win'):
def hotfix(loop: asyncio.AbstractEventLoop) -> asyncio.AbstractEventLoop:
loop.call_soon(_wakeup, loop, 1.0)
return loop
You can’t perform that action at this time.