Skip to content

Instantly share code, notes, and snippets.

Avatar
🇯🇵
I don't use Windows/Linux so send me PRs for those OS

Alisue lambdalisue

🇯🇵
I don't use Windows/Linux so send me PRs for those OS
View GitHub Profile
@lambdalisue
lambdalisue / spoof.py
Last active Feb 14, 2020
Spoof process parent in Windows via Win32 APIs
View spoof.py
import ctypes
from contextlib import contextmanager, ExitStack
from ctypes import byref, sizeof, Structure, POINTER
from ctypes import wintypes
# Alias
windll = ctypes.windll # type: ignore
WinError = ctypes.WinError # type: ignore
SIZE_T = ctypes.c_size_t
TRUE = 1
View provider.vim
let s:Promise = vital#fern#import('Async.Promise')
let s:AsyncLambda = vital#fern#import('Async.Lambda')
let s:root = {
\ 'name': 'TabPages',
\ 'status': 1,
\ '_kind': 'root',
\}
function! fern#scheme#tabpage#provider#new() abort
@lambdalisue
lambdalisue / benchmark (Neovim)
Created Feb 2, 2020
Result of 'call fern#scheme#file#provider#_benchmark()'
View benchmark (Neovim)
Creating benchmark environment ...
Benchmarking 'ls' ...
0.003170
Benchmarking 'find' ...
0.001505
Benchmarking 'vim_glob' ...
1.894150
@lambdalisue
lambdalisue / remove-atficats.py
Created Jan 31, 2020
Remove all artifacts from a particular repository
View remove-atficats.py
#!/usr/bin/env python
import re
import time
from typing import Iterator, Tuple, Optional
import requests
# ================================================================
TOKEN = "****************************************"
USER = "username"
@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-
You can’t perform that action at this time.