Maintail symlink: "today.html", "yesterday.html"
492700
def update_html_symlink(html_dir):
    "
    today = datetime.date.today()
    yesterday = datetime.date.today() - datetime.timedelta(days=1)

    for from_date, alias_name in (
            (today, 'today.html'), (yesterday, 'yesterday.html')):
        from_date_file_path = os.path.join(html_dir, 'day_%s.html' % from_date)
        symlink_path = os.path.join(html_dir, alias_name)
        try:                                                                                         
            os.unlink(symlink_path)                                                                  
        except OSError:                                                                              
            pass                                                                                     
        os.symlink(from_date_file_path, symlink_path)
641207
def link(args):
    
    from jcvi.apps.base import mkdir

    p = OptionParser(link.__doc__)
    p.add_option("--dir",
                 help="Place links in a subdirectory [default: %default]")
    opts, args = p.parse_args(args)

    if len(args) != 1:
        sys.exit(not p.print_help())

    meta, = args
    d = opts.dir
    if d:
        mkdir(d)

    fp = open(meta)
    cwd = op.dirname(get_abs_path(meta))
    for row in fp:
        source, target = row.split()
        source = op.join(cwd, source)
        if d:
            target = op.join(d, target)
        lnsf(source, target, log=True)
768953
function link (presetModulePath, keep) {
  debug(`input ${presetModulePath}`)

  console.log('update config file:')

  findConfigFiles(presetModulePath)
    .forEach(configFilePath => {
      updateConfigFiles(configFilePath, keep)
    })
}
263726
def main():
    
    try:
        # Get the `src` directory's absolute path
        src_path = os.path.dirname(
            # `aoiklivereload` directory's absolute path
            os.path.dirname(
                # `demo` directory's absolute path
                os.path.dirname(
                    # This file's absolute path
                    os.path.abspath(__file__)
                )
            )
        )

        # If the `src` directory path is not in `sys.path`
        if src_path not in sys.path:
            # Add to `sys.path`.
            #
            # This aims to save user setting PYTHONPATH when running this demo.
            #
            sys.path.append(src_path)

        # Import reloader class
        from aoiklivereload import LiveReloader

        # Create reloader
        reloader = LiveReloader()

        # Start watcher thread
        reloader.start_watcher_thread()

        # Server host
        server_host = '0.0.0.0'

        # Server port
        server_port = 8000

        # Get message
        msg = '# ----- Run server -----\nHost: {}\nPort: {}'.format(
            server_host, server_port
        )

        # Print message
        print(msg)

        # Create Flask app
        flask_app = flask.Flask(__name__)

        # Create request handler
        @flask_app.route('/')
        def hello_handler():  # pylint: disable=unused-variable
            """
            Request handler.

            :return:
                Response body.
            """
            # Return response body
            return 'hello'

        # Run server
        flask_app.run(
            host=server_host,
            port=server_port,
            # Disable Flask's reloader
            debug=False,
        )

    # If have `KeyboardInterrupt`
    except KeyboardInterrupt:
        # Not treat as error
        pass
1140833
function embed(sourcePath, relativePaths, name, done) {
  var items = '';
  each(relativePaths, function(relativePath, next) {
    var fullPath = path.join(sourcePath, relativePath);
    fs.readFile(fullPath, 'utf8', function(err, text) {
      if (err) return next(err);
      items += '  $templateCache.put(\'' +
        inline(relativePath) + '\', \'' +
        inline(text.trim()) + '\');\n';
      next();
    });
  }, function(err) {
    if (err) return done(err);
    console.log(
      'angular.module(\'' + inline(name) + '\', []).run([\'$templateCache\', function($templateCache) {\n' +
      items +
      '}]);');
    done();
  });
}
1248363
def symlink(self, source, dest):
        
        dest = self._adjust_cwd(dest)
        self._log(DEBUG, 'symlink(%r, %r)' % (source, dest))
        source = bytestring(source)
        self._request(CMD_SYMLINK, source, dest)
1308009
def cp(args):
    
    p = OptionParser(cp.__doc__)
    fp = sys.stdin

    for link_name in fp:
        link_name = link_name.strip()
        if not op.exists(link_name):
            continue

        source = get_abs_path(link_name)
        link_name = op.basename(link_name)
        if not op.exists(link_name):
            os.symlink(source, link_name)
        logging.debug(" => ".join((source, link_name)))
131736
def _write_symlink(self, zf, link_target, link_path):
        """"""
        info = zipfile.ZipInfo()
        info.filename = link_path
        info.create_system = 3
        # Magic code for symlinks / py2/3 compat
        # 27166663808 = (stat.S_IFLNK | 0755) << 16
        info.external_attr = 2716663808
        zf.writestr(info, link_target)
142154
function link($target, $link)
    {
        $this->files->ensureDirExists(
            $linkPath = $this->sitesPath(), user()
        );

        $this->config->prependPath($linkPath);

        $this->files->symlinkAsUser($target, $linkPath.'/'.$link);

        return $linkPath.'/'.$link;
    }
738497
def main():
    
    try:
        # Get the `src` directory's absolute path
        src_path = os.path.dirname(
            # `aoiklivereload` directory's absolute path
            os.path.dirname(
                # `demo` directory's absolute path
                os.path.dirname(
                    # This file's absolute path
                    os.path.abspath(__file__)
                )
            )
        )

        # If the `src` directory path is not in `sys.path`
        if src_path not in sys.path:
            # Add to `sys.path`.
            #
            # This aims to save user setting PYTHONPATH when running this demo.
            #
            sys.path.append(src_path)

        # Import reloader class
        from aoiklivereload import LiveReloader

        # Create reloader
        reloader = LiveReloader(
            # Reload mode.
            #
            # In windows, have to use `spawn_exit` reload mode and force the
            # current process to exit immediately, otherwise will get the
            # error:
            # ```
            # OSError: [WinError 10048] Only one usage of each socket address
            # (protocol/network address/port) is normally permitted
            # ```
            #
            # Notice in `spawn_exit` reload mode, the user will not be able
            # to kill the new process using Ctrl-c.
            #
            reload_mode=('spawn_exit' if sys.platform == 'win32' else 'exec'),
            force_exit=True,
        )

        # Start watcher thread
        reloader.start_watcher_thread()

        # Server host
        server_host = '0.0.0.0'

        # Server port
        server_port = 8000

        # Get message
        msg = '# ----- Run server -----\nHost: {}\nPort: {}'.format(
            server_host, server_port
        )

        # Print message
        print(msg)

        # Create request handler
        class HelloHandler(tornado.web.RequestHandler):
            """
            Request handler class.
            """

            def get(self):
                """
                Request handler.

                :return:
                    None.
                """
                # Write response body
                self.write('hello')

        # List of tuples that maps URL pattern to handler
        handler_tuples = [
            ('/', HelloHandler),
        ]

        # Create Tornado app
        tornado_app = tornado.web.Application(
            handler_tuples,
            # Disable Tornado's reloader
            debug=False,
        )

        # Start listening
        tornado_app.listen(server_port, address=server_host)

        # Get event loop
        io_loop = tornado.ioloop.IOLoop.current()

        # Run event loop
        io_loop.start()

    # If have `KeyboardInterrupt`
    except KeyboardInterrupt:
        # Not treat as error
        pass
245097
def atomic_symlink(src, dst):
    """"""

    dst_dir = os.path.dirname(dst)
    tmp = None
    max_tries = getattr(os, 'TMP_MAX', 10000)

    try:
        if not os.path.exists(dst_dir):
            os.makedirs(dst_dir)
        for n in range(max_tries):
            try:
                # mktemp is described as being unsafe. That is not true in this case since symlink is an
                # atomic operation at the file system level; if some other processes creates a file with
                # 'our' name then symlink will fail.
                tmp = tempfile.mktemp(dir=dst_dir)
                os.symlink(src, tmp)
                logger.debug('created symlink %s', tmp)
            except OSError as e:
                if e.errno == errno.EEXIST:
                    continue  # Someone else grabbed the temporary name first
                else:
                    raise
            logger.debug('renaming %s to %s', tmp, dst)
            os.rename(tmp, dst)
            return
    except:
        if tmp and os.path.exists(tmp):
            os.remove(tmp)
        raise
    raise IOError(errno.EEXIST, 'No usable temporary file name found')
1093372
function linkFromTemplate (templateDir, projectDir) {
    var linkSrc, linkDst, linkFolders, copySrc, copyDst;
    function rmlinkSync (src, dst, type) {
        if (src && dst) {
            fs.removeSync(dst);
            if (fs.existsSync(src)) {
                fs.symlinkSync(src, dst, type);
            }
        }
    }
    // if template is a www dir
    if (path.basename(templateDir) === 'www') {
        linkSrc = path.resolve(templateDir);
        linkDst = path.join(projectDir, 'www');
        rmlinkSync(linkSrc, linkDst, 'dir');
        copySrc = path.join(templateDir, 'config.xml');
    } else {
        linkFolders = ['www', 'merges', 'hooks'];
        // Link each folder
        for (var i = 0; i < linkFolders.length; i++) {
            linkSrc = path.join(templateDir, linkFolders[i]);
            linkDst = path.join(projectDir, linkFolders[i]);
            rmlinkSync(linkSrc, linkDst, 'dir');
        }
        linkSrc = path.join(templateDir, 'config.xml');
        linkDst = path.join(projectDir, 'config.xml');
        rmlinkSync(linkSrc, linkDst, 'file');
        copySrc = path.join(templateDir, 'www', 'config.xml');
    }
    // if template/www/config.xml then copy to project/config.xml
    copyDst = path.join(projectDir, 'config.xml');
    if (!fs.existsSync(copyDst) && fs.existsSync(copySrc)) {
        fs.copySync(copySrc, copyDst);
    }
}
903443
function startSites(config){
        config.siteNames.forEach(function(item){
            var cmd = 'iisexpress /site:"'  + item + '"';

            if(config.configFile !== ""){
                cmd += ' /config:"' + config.configFile + '"';
            }

            if (config.sysTray){
                cmd += ' /systray:true';
            }else{
                cmd += ' /systray:false';
            }

            gulp.src('')
                .pipe(shell([
                    cmd
                ],{
                    cwd: config.iisExpressPath
                }))
                .on('error', util.log);
        });

        return gulp.src('');
    }
1369266
def main():
    
    try:
        # Get the `src` directory's absolute path
        src_path = os.path.dirname(
            # `aoiklivereload` directory's absolute path
            os.path.dirname(
                # `demo` directory's absolute path
                os.path.dirname(
                    # This file's absolute path
                    os.path.abspath(__file__)
                )
            )
        )

        # If the `src` directory path is not in `sys.path`
        if src_path not in sys.path:
            # Add to `sys.path`.
            #
            # This aims to save user setting PYTHONPATH when running this demo.
            #
            sys.path.append(src_path)

        # Import reloader class
        from aoiklivereload import LiveReloader

        # Create reloader
        reloader = LiveReloader()

        # Start watcher thread
        reloader.start_watcher_thread()

        # Server host
        server_host = '0.0.0.0'

        # Server port
        server_port = 8000

        # Get message
        msg = '# ----- Run server -----\nHost: {}\nPort: {}'.format(
            server_host, server_port
        )

        # Print message
        print(msg)

        # Create request handler
        @bottle.get('/')
        def hello_handler():  # pylint: disable=unused-variable
            """
            Request handler.

            :return:
                Response body.
            """
            # Return response body
            return 'hello'

        # Run server
        bottle.run(host=server_host, port=server_port)

    # If have `KeyboardInterrupt`
    except KeyboardInterrupt:
        # Not treat as error
        pass
237586
function linkBootstrap() {
  fs.symlink(bootstrap, path.resolve(yeoman, 'bootstrap-less'), 'dir', function(err) {
    if (err) return console.log('symlink error:', err);
    return console.log('Successfully installed yeoman-bootstrap in', bootstrap,
      ' and created a symlink in', yeoman);
  });
}
1226594
def real_main(start_url=None,
              ignore_prefixes=None,
              upload_build_id=None,
              upload_release_name=None):
    """"""
    coordinator = workers.get_coordinator()
    fetch_worker.register(coordinator)
    coordinator.start()

    item = SiteDiff(
        start_url=start_url,
        ignore_prefixes=ignore_prefixes,
        upload_build_id=upload_build_id,
        upload_release_name=upload_release_name,
        heartbeat=workers.PrintWorkflow)
    item.root = True

    coordinator.input_queue.put(item)
    coordinator.wait_one()
    coordinator.stop()
    coordinator.join()
1362856
def get_symlinks(self, project_path, vars, mods):
        
        # Some additional symlinks
        if 'cms' in mods:
            # Mirroring Ckeditor JS overrides for the CKEditor cmsplugin that 
            # use a different namespace than 'django-ckeditor'
            self.symlink_list.append(('ckeditor', join(project_path, 'mods_available/ckeditor/static/djangocms_text_ckeditor')))

        # Enable all selected mods (it resumes to make a list of symlinks to 
        # do in mods_enabled)
        for name in mods:
            self.symlink_list.append((
                join('..', 'mods_available', name),
                join(project_path, 'mods_enabled', name)
            ))
        
        return self.symlink_list