Skip to content

Instantly share code, notes, and snippets.

View telemachus's full-sized avatar

Peter Aronoff telemachus

View GitHub Profile
@kylechui
kylechui / dot-repeating.md
Last active April 8, 2024 08:20
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

package main
import (
"fmt"
)
func fib(n int) int {
fibs := make(map[int]int, n+1)
fibs[0] = 0
fibs[1] = 1
@rgl
rgl / http-server-shutdown.go
Created December 23, 2020 07:02
go http server with graceful shutdown
package main
import (
"context"
"flag"
"log"
"net/http"
"os"
"os/signal"
"time"
@lv10
lv10 / Build VIM with python3
Last active November 25, 2023 23:42
Install Vim 8 with Python, Python 3 support on Ubuntu 20.04
# make sure you don't have any soon to be forgotten version of vim installed
$ sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
# Install Deps
$ sudo apt-get install build-essential cmake
$ sudo apt-get install python3-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
$ sudo apt-get install checkinstall
@AlmogBaku
AlmogBaku / bitly.go
Last active February 9, 2023 19:16
Golang Bitly: simple, stupid shortener written in go
package bitly
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
const BaseURL = "https://api-ssl.bitly.com/v4"
@brunerd
brunerd / maclTackle.command
Last active February 23, 2024 11:28
A hacky example to clean the com.apple.macl attribute from a file using zip to sidestep SIP on Catalina
#!/bin/bash
#clean the com.apple.macl attribute from a file or folders using zip to sidestep SIP on Catalina
#WARNING: This will overwrite the original file/folders with the zipped version - DO NOT use on production data
#hold down command key at launch or touch /tmp/debug to enable xtrace command expansion
commandKeyDown=$(/usr/bin/python -c 'import Cocoa; print Cocoa.NSEvent.modifierFlags() & Cocoa.NSCommandKeyMask > 1')
[ "$commandKeyDown" = "True" -o -f /tmp/debug ] && set -x && xtraceFlag=1
#hacky example to clean the com.apple.macl attribute from a file using zip to sidestep SIP
: <<-EOL
@mattmc3
mattmc3 / README.md
Last active January 2, 2024 00:50
zsh: zstyle examples

zstyle booleans

Setup foo,bar,baz boolean vars

zstyle ':example:foo' doit yes
zstyle ':example:bar' doit no
# leave baz unset
@lisawolderiksen
lisawolderiksen / git-commit-template.md
Last active April 22, 2024 13:01
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

@pjobson
pjobson / syncthing_ubuntu-mint_headless.md
Last active January 1, 2024 19:15
Syncthing Ubuntu/Mint Headless

Syncthing Ubuntu/Mint Headless

Syncthing: https://syncthing.net/

Syncthing is a free, open-source peer-to-peer file synchronization application available for Windows, Mac, Linux, Android, Solaris, Darwin, and BSD. It can sync files between devices on a local network, or between remote devices over the Internet. Data security and data safety are built into the design of the software.

This is written using Linux Mint 21.2 x86_64 using kernel 5.15.0-89-generic.

I couldn't find good directions for doing this, so here we go.

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 26, 2024 15:48
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example