Skip to content

Instantly share code, notes, and snippets.

View mgedmin's full-sized avatar

Marius Gedminas mgedmin

View GitHub Profile
$ sudo mount -t tmpfs -o size=4096 none /mnt/
$ echo put .viminfo /mnt/viminfo | sftp localhost
Connected to localhost.
sftp> put .viminfo /mnt/viminfo
Uploading .viminfo to /mnt/viminfo
.viminfo 31% 32KB 32.0KB/s 00:02 ETA
Couldn't write to remote file "/mnt/viminfo": Failure
$ echo $?
0
@mgedmin
mgedmin / askpass.py
Last active October 21, 2019 13:32
[ansible] vault_password_file = askpass.py
#!/usr/bin/env python
import sys
import getpass
import argparse
try:
# Suppress PyGI warning (LP: #1510392)
import gi
gi.require_version('GnomeKeyring', '1.0')
except (ImportError, ValueError):
An error occured. This is either a bug in UltiSnips or a bug in a
snippet definition. If you think this is a bug, please report it to
https://github.com/SirVer/ultisnips/issues/new.
Following is the full stack trace:
Traceback (most recent call last):
File "/home/mg/.vim/bundle/UltiSnips/pythonx/UltiSnips/err_to_scratch_buffer.py", line 16, in wrapper
return func(self, *args, **kwds)
File "/home/mg/.vim/bundle/UltiSnips/pythonx/UltiSnips/snippet_manager.py", line 138, in expand_or_jump
rv = self._try_expand()
location ~ /.well-known/acme-challenge/ {
root /var/www/html/;
try_files $uri $uri/ =404;
}
Alias /.well-known/acme-challenge {{ letsencrypt_webroot }}/.well-known/acme-challenge
<Directory {{ letsencrypt_webroot }}>
Order allow,deny
Allow from all
Satisfy Any
</Directory>
#!/usr/bin/env python3
import asyncio.subprocess
import signal
import sys
@asyncio.coroutine
def run_in_background(*command, prefix):
proc = yield from asyncio.create_subprocess_exec(*command,
stdout=asyncio.subprocess.PIPE,

Test case for vim/vim#870:

  1. Clone this gist
  2. vim -i viminfo.test
## hostvars:
letsencrypt_certs:
- demo.ubuntu.lt
- ubuntu.lt, www.ubuntu.lt
- legacy.ubuntu.lt
## my letsencrypt role's main/tasks.yml:
- name: generate certificates
@mgedmin
mgedmin / jenkins.md
Last active April 3, 2019 17:33
Installing latest Jenkins on Ubuntu

Installing upstream Jenkins

  1. Make sure you don't have Jenkins installed from Ubuntu repositories -- you'll get problems if you try to mix it with upstream packages
apt-get purge jenkins --auto-remove
  1. Add the upstream Jenkins package repository

Visualize the way gvim draws text

The script 'vis.py' loads a log of drawing calls from a file called draw.log (produced by running 'gvim -f > draw.log' after applying vim.patch and rebuilding). It lets you single-step through them using <Left>/<Right> keys. Use 'q' to quit.

The last draw call is highlighted in blue.

This gist contains a snapshot of draw calls produced by running gvim, typing :help, then pressing <PageDown> to scroll one page and finally quitting with :qa.