Windows templates also include the nanny.
426938
def MakeExecutableTemplate(self, output_file=None):
    """"""
    super(WindowsClientBuilder,
          self).MakeExecutableTemplate(output_file=output_file)

    self.MakeBuildDirectory()
    self.BuildWithPyInstaller()

    # Get any dll's that pyinstaller forgot:
    for module in EnumMissingModules():
      logging.info("Copying additional dll %s.", module)
      shutil.copy(module, self.output_dir)

    self.BuildNanny()

    # Generate a prod and a debug version of nanny executable.
    shutil.copy(
        os.path.join(self.output_dir, "GRRservice.exe"),
        os.path.join(self.output_dir, "dbg_GRRservice.exe"))
    with open(os.path.join(self.output_dir, "GRRservice.exe"), "r+") as fd:
      build.SetPeSubsystem(fd, console=False)
    with open(os.path.join(self.output_dir, "dbg_GRRservice.exe"), "r+") as fd:
      build.SetPeSubsystem(fd, console=True)

    # Generate a prod and a debug version of client executable.
    shutil.copy(
        os.path.join(self.output_dir, "grr-client.exe"),
        os.path.join(self.output_dir, "dbg_grr-client.exe"))
    with open(os.path.join(self.output_dir, "grr-client.exe"), "r+") as fd:
      build.SetPeSubsystem(fd, console=False)
    with open(os.path.join(self.output_dir, "dbg_grr-client.exe"), "r+") as fd:
      build.SetPeSubsystem(fd, console=True)

    self.MakeZip(self.output_dir, self.template_file)
474245
def build_template(self, mapfile, names, renderer):
        
        AVAILABLE_DUMPS = json.load(open(mapfile, "r"))

        manager = self.get_deps_manager(AVAILABLE_DUMPS)

        fp = StringIO.StringIO()

        for i, item in enumerate(manager.get_dump_order(names), start=1):
            fp = renderer(fp, i, item, manager[item])

        if self.dump_other_apps:
            exclude_models = ['-e {0}'.format(app) for app in
                    self.exclude_apps]
            for i, item in enumerate(manager.get_dump_order(names), start=1):
                for model in manager[item]['models']:
                    if '-e ' not in model:
                        model = "-e {0}".format(model)
                    if model not in exclude_models:
                        exclude_models.append(model)
            fp = renderer(fp, i+1, 'other_apps', {'models': exclude_models,
                                                  'use_natural_key': True})

        content = fp.getvalue()
        fp.close()

        context = self.get_global_context().copy()
        context.update({'items': content})

        return self.base_template.format(**context)
751622
function writeMasterTemplate(cmdOptions, callback) {
  var location = path.normalize(cmdOptions.location);
  var logRoot = cmdOptions.log || ('/var/log/' + cmdOptions.app);
  buildMasterTemplate({
    user: cmdOptions.user,
    logRoot: logRoot,
    writePath: location + '/master.conf',
    templateOpt: cmdOptions.template
  }, callback);
}
1043186
def __combine_windows(w1, w2):
    
    res = []
    for s1, s2 in zip(w1, w2):
        res.append(slice(min(s1.start, s2.start), max(s1.stop, s2.stop)))
    return tuple(res)
650251
function getTemplatesTasks(baseTask, app) {
	var tasks = [];
	var templates = getTemplates(app);

	if (templates) {
		for (index = 0; index < templates.length; ++index) {
		    tasks.push(baseTask + '.' + templates[index]);
		}
	}

	return tasks;
}
1195116
def duplicate_template(template)
        input = gets.chomp.strip
        case
        when input.downcase == "b"
          jumpstart_menu
        when input.downcase == "x"
          exit_normal
        when JumpStart.existing_templates.include?(input)
          puts "  The template ".red + input.red_bold + " already exists. Please enter a unique name for the duplicate.".red
          duplicate_template(template)
        when input.length < 3
          puts "  The template name ".red + input.red_bold + " is too short. Please enter a name that is at least 3 characters long.".red
          duplicate_template(template)
        when input.match(/^\W|\W$/)
          puts "  The template name ".red + input.red_bold + " begins or ends with an invalid character. Please enter a name that begins with a letter or a number.".red
          duplicate_template(template)
        else
          files_and_dirs = FileUtils.sort_contained_files_and_dirs(FileUtils.join_paths(JumpStart.templates_path, template))
          FileUtils.mkdir_p(FileUtils.join_paths(JumpStart.templates_path, input, "jumpstart_config"))
          FileUtils.touch(FileUtils.join_paths(JumpStart.templates_path, input, "jumpstart_config", "#{input}.yml"))
          files_and_dirs[:dirs].each {|x| FileUtils.mkdir_p(FileUtils.join_paths(JumpStart.templates_path, input, x))}
          files_and_dirs[:files].each do |x|
            if x.match(/\/jumpstart_config\/#{template}\.yml/)
              FileUtils.copy_file(FileUtils.join_paths(JumpStart.templates_path, template, x), FileUtils.join_paths(JumpStart.templates_path, input, "jumpstart_config", "#{input}.yml") )
            else
              FileUtils.cp(FileUtils.join_paths(JumpStart.templates_path, template, x), FileUtils.join_paths(JumpStart.templates_path, input, x))
            end
          end
          puts "\n  Duplication complete!".green_bold
          puts "  Template " + template.green + " has been duplicated to " + input.green
          jumpstart_menu
        end
      end
306382
def getTemplates(self, workitems, template_folder=None,
                     template_names=None, keep=False, encoding="UTF-8"):
        

        self.templater.getTemplates(workitems,
                                    template_folder=template_folder,
                                    template_names=template_names,
                                    keep=keep,
                                    encoding=encoding)
565361
function template(tmpl, context) {
			return tmpl.replace(/\{([^\}]+)\}/g, function(m, key) {
				return context[key];
			});
		}
279814
def templates_dir_menu
        puts "\n\n******************************************************************************************************************************************\n\n"
        puts "  JUMPSTART TEMPLATES DIRECTORY OPTIONS\n".purple
        puts "  The JumpStart template directory is currently: " + JumpStart.templates_path.green
        puts "\n  1".yellow + " Change the templates directory.\n"
        puts "  2".yellow + " Reset the templates directory to default.\n\n"
        puts "  b".yellow + " Back to main menu.\n\n"
        puts "  x".yellow + " Exit jumpstart.\n\n"
        puts "******************************************************************************************************************************************\n\n"
        templates_dir_options
      end
973026
function addTemplateToCompiler (mainCompiler, templatePath) {
  const childCompiler = getChildCompiler(mainCompiler);
  const isNew = childCompiler.addTemplate(templatePath);
  if (isNew) {
    clearCache(mainCompiler);
  }
}
543227
def include_template(*files)
      include_base = options[:include_base] || File.dirname(caller.first.split(/:\d/,2).first)
      files.each do |file|
        path = File.join(include_base, file)
        include_file(path)
      end
    end
1080243
private static function IncludeTemplate(){
            $oThis = self::CreateInstanceIfNotExists();

            $oThis->ReplaceVars();
            $oThis->sBuffer = trim($oThis->sBuffer);
            $Offset = 0;

            while(preg_match('/{include\s*(.*?)}/i', $oThis->sBuffer, $aMatches, PREG_OFFSET_CAPTURE, $Offset)){
                $sFilename = str_replace(array("'", '"'), "", $aMatches[1][0]);

                if(file_exists($sFilename)){
                    $sBufferAppend = file_get_contents($sFilename);
                    $oThis->sBuffer = str_replace($aMatches[0][0], $sBufferAppend, $oThis->sBuffer);
                }
                else{
                   $oThis->sBuffer = str_replace($aMatches[0][0], "", $oThis->sBuffer);
                }

                $Offset = $aMatches[0][1]+strlen($aMatches[0][0]);
            }
        }
805252
function(context, parent, args, container) {
		var name = args[0],
			template = args[1],
			node = document.createElement(name);
		template.toDOM(node, context, container);
		parent.appendChild(node);
	}
1119952
function registerTemplates(filepaths, callback) {
    async.map(filepaths, registerTemplate, function (err, templates) {
      if (err) callback(err);
      callback(null, templates);
    });
  }
410196
function PropHandlers_syncChildrenWithBindingList(bindingListName) {
        return {
            preCtorInit: function syncChildrenWithBindingList_preCtorInit(element, options, data, displayName, propName, value) {
                var latest = processChildren(displayName, value, {});
                data[propName] = {
                    winjsChildComponents: latest.childComponents,
                    winjsChildComponentsMap: latest.childComponentsMap
                };

                options[bindingListName] = new WinJS.Binding.List(
                    latest.childComponents.map(function (winjsChildComponent) {
                        return winjsChildComponent.winControl;
                    })
                );
            },
            update: function syncChildrenWithBindingList_update(winjsComponent, propName, oldValue, newValue) {
                var data = winjsComponent.data[propName] || {};
                var oldChildComponents = data.winjsChildComponents || [];
                var oldChildComponentsMap = data.winjsChildComponentsMap || {};
                var latest = processChildren(winjsComponent.displayName, newValue, oldChildComponentsMap);

                var bindingList = winjsComponent.winControl[bindingListName];
                if (bindingList) {
                    applyEditsToBindingList(
                        bindingList,
                        diffArraysByKey(oldChildComponents, latest.childComponents)
                    );
                } else {
                    winjsComponent.winControl[bindingListName] = new WinJS.Binding.List(latest.childComponents.map(function (winjsChildComponent) {
                        return winjsChildComponent.winControl;
                    }));
                }

                winjsComponent.data[propName] = {
                    winjsChildComponents: latest.childComponents,
                    winjsChildComponentsMap: latest.childComponentsMap
                };
            },
            dispose: function syncChildrenWithBindingList_dispose(winjsComponent, propName) {
                var data = winjsComponent.data[propName] || {};
                var childComponents = data.winjsChildComponents || [];
                childComponents.forEach(function (winjsChildComponent) {
                    winjsChildComponent.dispose();
                });
            }
        }
    }
1314718
public Template getTemplate(final String parentName, final String name) throws ResourceNotFoundException {
        return getTemplate(this.loader.concat(parentName, name));
    }
230527
def script_template(state, host, template_filename, chdir=None, **data):
    '''
    
    '''

    temp_file = state.get_temp_filename(template_filename)
    yield files.template(state, host, template_filename, temp_file, **data)

    yield chmod(temp_file, '+x')

    if chdir:
        yield 'cd {0} && {1}'.format(chdir, temp_file)
    else:
        yield temp_file