Skip to content

Instantly share code, notes, and snippets.

View ganwell's full-sized avatar
💭
Gluing elephants to the ceiling

Jean-Louis Fuchs ganwell

💭
Gluing elephants to the ceiling
View GitHub Profile
@ganwell
ganwell / find.diff
Created August 8, 2019 16:05
Better find.kak
diff --git a/jlf/kak/conf.d/find.kak b/jlf/kak/conf.d/find.kak
index aa81e4d..9f32f80 100644
--- a/jlf/kak/conf.d/find.kak
+++ b/jlf/kak/conf.d/find.kak
@@ -20,7 +20,7 @@ If <pattern> is not specified, the content of the main selection is used
# merge selections that are on the same line
exec '<a-s><a-L><a-;>;'
eval -save-regs 'c"' -itersel %{
- reg c "%val{bufname}:%val{cursor_line}:"
+ reg c "%val{bufname}:%val{cursor_line}:%val{cursor_column}:"
@ganwell
ganwell / _Permanent local changes
Last active July 29, 2019 15:13
Manage "permanent" lcoal changes in git-repos
We have directory for our Repositories: ~/Repositories
In there is ~/Repositories/projectA and ~/Repositories/projectA.stash. The
command save will save all files defined in projectA.stash to the stash and to
~/Repositories/projectA.patch. Load will search the save and pop it from stash. Reload
will apply ~/Repositories/projectA.patch in case you lost the stash or moved to
another machine.
I have the *.stash and *.patch under separete version control.
decl -hidden int find_current_line 0
def -params ..1 -docstring "
find [<pattern>]: search for a pattern in all buffers
If <pattern> is not specified, the content of the main selection is used
" find %{
try %{
eval %sh{ [ -z "$1" ] && echo fail }
reg / %arg{1}
} catch %{
@ganwell
ganwell / fillspace.sh
Last active July 12, 2019 19:30
viel kak
#!/usr/bin/env python3
import os
from subprocess import Popen, PIPE
proc = Popen(
["xsel", "-o", "-b"], stdout=PIPE
)
linesep = bytes(os.linesep, encoding="UTF-8")
stdout, _ = proc.communicate()
@ganwell
ganwell / complete.vim
Last active June 28, 2019 09:12
Completion-as-you-time with timer: not simple anymore, I had to workaround many vim/neovim bugs (works with neovim v0.4)
" Set the complete-options that are best for auto-completion as you type:
" * menuone: show the (pop-up-)menu even when there is only one entry
" * preview: show the documentation for the current completion if available
" * noinsert: only insert a completion if the user presses enter
" * also do not set noselect/longest, since we want vim to select the first entry, so
" enter is sufficient to insert the completion
set completeopt=menuone,preview,noinsert
" Enable dictionary completions
set complete+=k
@ganwell
ganwell / py.py
Last active February 4, 2019 16:09
class GenQueue(GenericStateMachine):
...
with settings(max_examples=2000):
TestQueue = GenQueue.TestCase
@ganwell
ganwell / session
Last active February 2, 2019 19:38
vsplit
arga *.rst **/*.rst
arga *.py **/*.py
arga *.pyx **/*.pyx
arga *.c **/*.c
arga *.rgc **/*.rgc
arga *.h **/*.h
arga *.rgh **/*.rgh
arga *.html **/*.html
arga *.css **/*.css
@ganwell
ganwell / players.ml
Last active December 16, 2018 18:43
Move exceptions to compiler errors?
(* I am a newbie and its quite probable that I am trying to achieve something
* unnecessary or otherwise wrong.
*
* I have a program written in a dynamically typed language, where I have a lot
* assert_X_consistency functions that will run after every state change, so any
* inconsistency I thought of, will raise an exception. I heard that a good type
* system allows you to encode the state in a way that doesn't allow the
* inconsistencies at compile-time.
*
* What I am trying to move to the compiler is: 'assert a is in team0'
@settings(deadline=None, timeout=unlimited)
def test_func(capsys):
"""Functional test of chirp."""
def init_with_capsys():
return GenFunc(capsys)
with settings(deadline=None, timeout=unlimited):
run_state_machine_as_test(init_with_capsys)
1042.ch [/root]
# certbot
Traceback (most recent call last):
File "/usr/bin/certbot", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3086, in <module>
@_call_aside
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3070, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3099, in _initialize_master_working_set