This file contains 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
local uv = vim.loop | |
local sock = assert(uv.new_pipe()) | |
uv.pipe_connect(sock, "/run/user/1000/redis.sock", function(err) assert(err == nil, err) end) | |
uv.read_start(sock, function(err, data) | |
if err then | |
print("read error", err) | |
elseif data then | |
print("read data", data) |
This file contains 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
---@diagnostic disable: unused-local | |
--design choices/limits | |
--* sudo runs in a tty process | |
--* sudo should run in background | |
--* prompt user to enter his password when needed | |
--* singleton | |
--* sync but not blocking nvim | |
-- | |
--supported forms: |
This file contains 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
pub fn ParkingLot(comptime Config: type) type { | |
return struct { | |
pub const Lock: type = Config.Lock; | |
pub const Event: type = Config.Event; | |
pub const nanotime: fn() u64 = switch (@hasDecl(Config, "nanotime")) { | |
true => Config.nanotime, |
This file contains 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
/// mntpoints come from fstab | |
const std = @import("std"); | |
const mem = std.mem; | |
const linux = std.os.linux; | |
const assert = std.debug.assert; | |
const os = std.os; | |
const c_fstab = @cImport(@cInclude("fstab.h")); | |
allocator: mem.Allocator, |
This file contains 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
#!/usr/bin/env python3 | |
import os | |
import sys | |
def as_xsel_args(): | |
"""only supports xclip options that are used by pass | |
* xclip -selection "$X_SELECTION" |
This file contains 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
-- inlinecmd | |
-- b:asyncrun_plaincmd | |
local M = {} | |
local inlinecmd_magic = "# asyncrun: " | |
local plaincmd_varname = "asyncrun_plaincmd" | |
local find_inlinecmd = function(bufnr) | |
local _reversed_lines = function(high) |
This file contains 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 std/[asyncdispatch, asyncnet, nativesockets, asyncfutures] | |
import std/[tables, deques] | |
type Nursery = object | |
tasks: seq[Future[void]] | |
proc startSoon(self: ref Nursery, fut: Future[void]) = | |
asyncCheck fut | |
self.tasks.add fut |
This file contains 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
<?php | |
# Swoole\Coroutine::enableScheduler(); | |
Co\run(function () { | |
$flag = 1; | |
go(function() use(&$flag) { | |
assert($flag == 1); | |
$flag += 1; |
This file contains 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
#!/usr/bin/env python3 | |
import os | |
import trio | |
from trio.lowlevel import FdStream | |
from blessed import Terminal | |
from blessed.keyboard import Keystroke, resolve_sequence |
This file contains 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
# resize pane | |
# take a look at `-i` option of command-prompt | |
bind R command-prompt -i -p 'resize-pane' 'run-shell "~/.scripts/:resize %%"' |
NewerOlder