Skip to content

Instantly share code, notes, and snippets.


Marius Gedminas mgedmin

View GitHub Profile
yegappan / VimScriptForPythonDevelopers.MD
Last active Jun 16, 2021
Vim script for Python Developers
View VimScriptForPythonDevelopers.MD

Vim Script for Python Developers

A guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with Python programming.

For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way

For a guide similar to this one for JavaScript developers, refer to Vim Script for the JavaScripter

This guide only describes the programming constructs that are present in both Python and Vim. The constructs that are unique to Vim (e.g. autocommands, key-mapping,

romainl / dynaline.gif
Last active May 19, 2021
How to add dynamic highlighted parts to your status-line
romainl /
Last active Jun 14, 2021
The right way to override any highlighting if you don't want to edit the colorscheme file directly

The right way to override any highlighting if you don't want to edit the colorscheme file directly

Generalities first

Suppose you have weird taste and you absolutely want:

  • your visual selection to always have a green background and black foreground,
  • your active statusline to always have a white background and red foreground,
  • your very own deep blue background.
FauxFaux /
Last active Jun 10, 2021
What does Ubuntu's do-release-upgrade script actually do?

Ubuntu encourage upgrading between releases by running a command, instead of by manually editing sources and getting on with it. This tool's name is do-release-upgrade, and I believe it should just be doing:

sed -i 's/wily/xenial/g' /etc/apt/sources.list /etc/apt/sources.list.d/*

This command does not explain what it wants to do, or why it is doing anything. It has, in the past:

  • Disabled repos I was using, and hence broken the software in them.

Triangle Workflows

A triangle workflow involves an upstream project and a personal fork containing a development branch of the project. This configuration makes git pull merge changes from the upstream but git push send local commits to the personal fork. However those config settings only work on relatively recent versions of git; 1.7.9 doesn't support the required remote.pushdefault config setting so you will have to explicitly tell git push which remote to push to.

This gist does not attempt to explain exactly what these commands do, it's intended as a cheat-sheet/reminder.

To set up a project area

View Python Inconsistencies.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
samhocevar / gist:00eec26d9e9988d080ac
Last active Apr 22, 2021
Configure sshd on MSYS2 and run it as a Windows service
View gist:00eec26d9e9988d080ac
# — configure sshd on MSYS2 and run it as a Windows service
# Please report issues and/or improvements to Sam Hocevar <>
# Prerequisites:
# — MSYS2 itself:
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
View woodo
if [ $EUID != 0 ]; then
echo "It's a weird tree."
echo ' _ __'
echo ' / `\ (~._ ./ )'
echo ' \__/ __`-_\__/ ./'
echo ' _ \ \/ \ \ |_ __'
echo ' ( ) \__/ -^ \ / \'
echo ' \_/ " \ | o o |.. / __'
echo " \\. --' ==== / || / \\ "
lelandbatey /
Last active Jun 8, 2021
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!


This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"


# Migrate from sentry-comments to build in notes.
# See also
# Especially when you're upgrading from Sentry 6.3.
# To run this script:
# sentry shell
# >>> import
# >>> migratecomments.migrate()