Skip to content

Instantly share code, notes, and snippets.

@dseeni
dseeni / Proof.hs
Created October 17, 2024 08:43 — forked from madsbuch/Proof.hs
{-# LANGUAGE GADTs #-} -- Soft dependent types
{-# LANGUAGE PolyKinds #-} -- Allow general specification of Refl
{-# LANGUAGE RankNTypes #-} -- Explicit quantification and inline type context
{-# LANGUAGE DataKinds #-} -- Lift data constructors to Kind level
{-# LANGUAGE TypeFamilies #-} -- Equational reasoning about types
{-# LANGUAGE TypeOperators #-} -- Allow types such as :~:
-- Starting the interactive shell:
--
-- ghci -XDataKinds -XTypeOperators -Wall -Werror Script.hs
@dseeni
dseeni / html.lua
Created September 30, 2023 20:20 — forked from soulik/html.lua
HTML/XML grammar LPEG parser for Lua
local lpeg = require 'lpeg'
local L = lpeg.locale()
local P,V,C,Ct,S,R,Cg,Cc =
lpeg.P, lpeg.V, lpeg.C, lpeg.Ct, lpeg.S, lpeg.R, lpeg.Cg, lpeg.Cc
local ws = S'\r\n\f\t\v '
local ws0 = ws^0
local ws1 = ws^1
local name = S'_ ' + L.digit + L.alpha
@dseeni
dseeni / dot-repeating.md
Created August 2, 2023 00:27 — forked from kylechui/dot-repeating.md
A basic overview of how to manage dot-repeating in your Neovim plugin, as well as manipulate it to "force" what action is repeated.

Adding dot-repeat to your Neovim plugin

In Neovim, the . character repeats "the most recent action"; however, this is not always respected by plugin actions. Here we will explore how to build dot-repeat support directly into your plugin, bypassing the requirement of dependencies like repeat.vim.

The Basics

When some buffer-modifying action is performed, Neovim implicitly remembers the operator (e.g. d), motion (e.g. iw), and some other miscellaneous information. When the dot-repeat command is called, Neovim repeats that operator-motion combination. For example, if we type ci"text<Esc>, then we replace the inner contents of some double quotes with text, i.e. "hello world""text". Dot-repeating from here will do the same, i.e. "more samples""text".

Using operatorfunc

@dseeni
dseeni / regular_expression_engine_comparison.md
Created April 21, 2023 17:56 — forked from CMCDragonkai/regular_expression_engine_comparison.md
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

@dseeni
dseeni / regular_expression_engine_comparison.md
Created April 21, 2023 17:55 — forked from ninmonkey/regular_expression_engine_comparison.md
Forked CSS Test - Regular Expression Engine Comparison Chart

About

  • Style[s] don't affect github's render
  • it works on local markdown previews

Render from VS Code

render-of-gist

@dseeni
dseeni / pipelines.py
Created March 18, 2023 01:36 — forked from fmoralesc/pipelines.py
Shell Pipelines for Python
from subprocess import Popen, PIPE
import re
import glob
import shlex
class Pipeline(object):
def __init__(self, descriptor=None):
self.steps = []
if descriptor:
for step in descriptor.split("|"):
@dseeni
dseeni / lazy-load-pwsh-module.ps1
Created March 10, 2023 20:24 — forked from hyrious/lazy-load-pwsh-module.ps1
lazy load in powershell
$LazyLoadProfile = [PowerShell]::Create()
[void]$LazyLoadProfile.AddScript(@'
Import-Module posh-git
'@)
$LazyLoadProfileRunspace = [RunspaceFactory]::CreateRunspace()
$LazyLoadProfile.Runspace = $LazyLoadProfileRunspace
$LazyLoadProfileRunspace.Open()
[void]$LazyLoadProfile.BeginInvoke()
@AksAman
AksAman / gzf-git-log.sh
Last active May 24, 2023 23:29
Alias to view git log in a pretty way with fuzzy search and files preview using fzf
# fzf from https://github.com/junegunn/fzf
# diff-so-fancy from https://github.com/so-fancy/diff-so-fancy
gcop() {
git log \
--reverse \
--color=always \
--format="%C(cyan)%h %C(blue)%ar%C(auto)%d% C(yellow)%s%+b %C(magenta)%ae" "$@" |
fzf -i -e +s \
--reverse \
@kylechui
kylechui / dot-repeating.md
Last active November 19, 2025 06:00
A basic overview of how to manage dot-repeating in your Neovim plugin, as well as manipulate it to "force" what action is repeated.

Adding dot-repeat to your Neovim plugin

In Neovim, the . character repeats "the most recent action"; however, this is not always respected by plugin actions. Here we will explore how to build dot-repeat support directly into your plugin, bypassing the requirement of dependencies like repeat.vim.

The Basics

When some buffer-modifying action is performed, Neovim implicitly remembers the operator (e.g. d), motion (e.g. iw), and some other miscellaneous information. When the dot-repeat command is called, Neovim repeats that operator-motion combination. For example, if we type ci"text<Esc>, then we replace the inner contents of some double quotes with text, i.e. "hello world""text". Dot-repeating from here will do the same, i.e. "more samples""text".

Using operatorfunc

@belotn
belotn / VIMBinding.ps1
Last active March 8, 2025 21:50
KeyHandler and function for some VI text manipulation ci, ca, di and da in #Powershell #PSReadLine
Set-PSReadLineKeyHandler -Chord "c,i" -ViMode Command -ScriptBlock { VIChangeInnerBlock }
Set-PSReadLineKeyHandler -Chord "c,a" -ViMode Command -ScriptBlock { VIChangeOuterBlock }
Set-PSReadLineKeyHandler -Chord "d,i" -ViMode Command -ScriptBlock { VIDeleteInnerBlock }
Set-PSReadLineKeyHandler -Chord "d,a" -ViMode Command -ScriptBlock { VIDeleteOuterBlock }
Set-PSReadLineKeyHandler -Chord "c,s" -ViMode Command -ScriptBlock { VIChangeSurround }
Set-PSReadLineKeyHandler -Chord "d,s" -ViMode Command -ScriptBlock { VIDeleteSurround }
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -ViMode Command `
-ScriptBlock { VIIncrement $args[0] $args[1] }
Set-PSReadLineKeyHandler -Chord "Ctrl+x" -ViMode Command `
-ScriptBlock { VIDecrement $args[0] $args[1] }