Skip to content

Instantly share code, notes, and snippets.

View ngrilly's full-sized avatar

Nicolas Grilly ngrilly

View GitHub Profile
#!/usr/bin/env python3
import os
import sys
from string import Template
for in_line in sys.stdin.readlines():
out_line = Template(in_line).safe_substitute(os.environ)
sys.stdout.write(out_line)
@zeekay
zeekay / mtime_file_watcher.py
Last active January 8, 2022 20:59
Replacement MtimeFileWatcher for App Engine SDK's dev_appserver.py
#!/usr/bin/env python
#
# Replacement `MtimeFileWatcher` for App Engine SDK's dev_appserver.py,
# designed for OS X. Improves upon existing file watcher (under OS X) in
# numerous ways:
#
# - Uses FSEvents API to watch for changes instead of polling. This saves a
# dramatic amount of CPU, especially in projects with several modules.
# - Tries to be smarter about which modules reload when files change, only
# modified module should reload.
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}