Skip to content

Instantly share code, notes, and snippets.

@hikerpig
Last active September 2, 2020 06:33
Show Gist options
  • Save hikerpig/fdf842afea5dbaf2e2f0d322a67c3bf9 to your computer and use it in GitHub Desktop.
Save hikerpig/fdf842afea5dbaf2e2f0d322a67c3bf9 to your computer and use it in GitHub Desktop.
UltiSnips snippet for gerrit
global !p
#! /usr/bin/env python
import hashlib
def make_change_id():
fd = open("/dev/urandom", "rb")
buf = fd.read(80)
hash = hashlib.sha1()
hash.update(buf)
change_id = hash.hexdigest()
return "Change-Id: I" + change_id
endglobal
snippet changeid "Generate Change-Id line"
`!p if not snip.c: snip.rv = make_change_id()`
endsnippet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment