Add bin file.

@param \Phar $phar
Phar object.
@param string $binFile
Path to bin file.
339530
protected function addBinFile($phar, $binFile)
    {
        $relativeBinFile = str_replace($this->projectPath, '', $binFile);
        $this->logger->log('<comment>Adding file</comment> ' . $relativeBinFile);

        $content = file_get_contents($binFile);
        $content = preg_replace('{^#!/usr/bin/env php\s*}', '', $content);

        $phar->addFromString($relativeBinFile, $content);
        $this->increaseFileCounter();
    }
1329664
protected function create()
    {
        $this->setReleaseVersion();

        $output = $this->getDestination() . '/' . $this->getFilename();

        $phar = new Phar($output, FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME);
        $phar->buildFromDirectory(Context::getParam('project-root'), $this->options['excluded-paths']);
        $phar->setMetadata(array_merge(array('version' => $this->releaseVersion), $this->options['metadata']));
        $phar->setDefaultStub($this->options['default-stub-cli'], $this->options['default-stub-web']);

        return $output;
    }
902193
protected static function init_phar() {
		// For atomicity, new phar archives are first saved to a
		// temporary location and only moved to the final place the next
		// go around.
		if (@\is_file(\BLOBCOMMON_PHAR_PATH . '.new')) {
			// Couldn't move the new one.
			if (! @\rename(\BLOBCOMMON_PHAR_PATH . '.new', \BLOBCOMMON_PHAR_PATH)) {
				@\unlink(\BLOBCOMMON_PHAR_PATH . '.new');
			}
			\clearstatcache();
		}

		// Scheduled library updates.
		\add_action(
			'cron_blobcommon_library',
			array(static::class, 'check_phar')
		);
		if (false === ($timestamp = \wp_next_scheduled('cron_blobcommon_library'))) {
			\wp_schedule_event(\time(), 'daily', 'cron_blobcommon_library');
		}
		\register_deactivation_hook(
			\BLOBCOMMON_INDEX,
			array(static::class, 'unschedule_phar')
		);
	}
1106533
def _write_bin(self, data, stream, byte_order):
        '''
        

        '''
        _write_array(stream, _np.dtype(self.dtype(byte_order)).type(data))
1070423
protected function addUpdateFile(Phar $phar)
    {
        $file = $this->files->combine($this->pathBase, 'update.json');
        if ($this->files->exists($file)) {
            $this->addFile($phar, new SplFileInfo($file), false);
        }
    }
291107
public function actionIndex($configFile = false)
    {
        echo "Start building PHAR package...\n";

        $this->loadConfiguration($configFile);

        $this->clean(false);

        $phar = new \Phar(\Yii::getAlias($this->module->path), 0, $this->module->pharName);

        Builder::addFilesFromIterator($phar, $this->module);
        Builder::addStub($phar, $this->module->stub);
        Builder::addCompress($phar, $this->module->compress);
        Builder::addSignature($phar, $this->module->signature, $this->module->openSSLPrivateKeyAlias);

        echo "\n\nFinish\n";
    }
491245
function binadd(bin1, bin2){
  var i1 = bin1.length;
  var i2 = bin2.length;
  var i3 = (i1 > i2) ? (i1 + 1) : (i2 + 1);
  var result = new Array(i3);
  var c = 0;
  // Add the two arrays as long as there exist elements in the arrays
  while((i1 > 0) && (i2 > 0)){
    i1--;
    i2--;
    i3--;
    if(bin1[i1]){c++;}
    if(bin2[i2]){c++;}
    result[i3] = (c%2) ? true : false;
    c >>= 1;
  }
  // copy the remaining elements
  if(i1){
    for(var i=0; i<i1; i++){result[i+1] = bin1[i];}
  }else{
    for(var i=0; i<i2; i++){result[i+1] = bin2[i];}
  }
  // add the remaining carry
  var carry = c ? true : false;
  while(c && (i3 > 1)){
    i3--;
    result[i3] = !result[i3];
    c = !result[i3];
  }
  // Return result with carry if necessary
  if (c==1){
    result[0] = true;
    return result;
  }else{
    return result.slice(1);
  }
}
760568
def putbinaryfile(localfile, remotefile = File.basename(localfile),
		      blocksize = DEFAULT_BLOCKSIZE, &block) # :yield: data
      if @resume
        begin
          rest_offset = size(remotefile)
        rescue Net::FTPPermError
          rest_offset = nil
        end
      else
	rest_offset = nil
      end
      f = open(localfile)
      begin
	f.binmode
	storbinary("STOR " + remotefile, f, blocksize, rest_offset, &block)
      ensure
	f.close
      end
    end
843422
def add(self, histogram: Histogram1D):
        """"""
        if self.binning and not self.binning == histogram.binning:
            raise ValueError("Cannot add histogram with different binning.")
        self.histograms.append(histogram)
1266142
private function addComposerBin(\Phar $phar)
    {
        $this->info('add file BIN');

        $content = file_get_contents(base_path('artisan'));
        $content = preg_replace('{^#!/usr/bin/env php\s*}', '', $content);
        $phar->addFromString('artisan', $content);
    }
1292824
private function addLicense(Phar $phar)
    {
        $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../../LICENSE'), false);

        return $this;
    }
589693
private function addPHPFiles(Phar $phar)
    {
        $finder = new Finder();
        $finder
            ->files()
            ->ignoreVCS(true)
            ->name('*.php')
            ->notName('Compiler.php')
            ->in(realpath(__DIR__.'/../../src'));

        foreach ($finder as $file) {
            $this->addFile($phar, $file);
        }

        return $this;
    }
536097
public function store(BinaryInterface $binary, $path, $filter)
    {
        $this->flysystem->put(
            $this->getFilePath($path, $filter),
            $binary->getContent(),
            ['visibility' => $this->visibility]
        );
    }
533946
protected function addFile(
        Phar $phar,
        SplFileInfo $file,
        $strip = true
    ) {
        $path = strtr(str_replace(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR, '', $file->getRealPath()), '\\', '/');
        $content = file_get_contents($file);
        if ($strip) {
            $content = $this->stripWhitespace($content);
        } elseif ('LICENSE' === basename($file)) {
            $content = "\n" . $content . "\n";
        }

        if ($path === 'src/Composer/Composer.php') {
            $content = str_replace('@package_version@', $this->version, $content);
            $content = str_replace('@release_date@', $this->versionDate, $content);
        }

        $phar->addFromString($path, $content);

        return $this;
    }
251633
protected function addCdr64Eof(): void
    {
        $num_files = count($this->files);
        $cdr_length = $this->cdr_ofs;
        $cdr_offset = $this->ofs;

        $fields = [
            ['V', static::ZIP64_CDR_EOF_SIGNATURE],     // ZIP64 end of central file header signature
            ['P', 44],                                  // Length of data below this header (length of block - 12) = 44
            ['v', static::ZIP_VERSION_MADE_BY],         // Made by version
            ['v', Version::ZIP64],                      // Extract by version
            ['V', 0x00],                                // disk number
            ['V', 0x00],                                // no of disks
            ['P', $num_files],                          // no of entries on disk
            ['P', $num_files],                          // no of entries in cdr
            ['P', $cdr_length],                         // CDR size
            ['P', $cdr_offset],                         // CDR offset
        ];

        $ret = static::packFields($fields);
        $this->send($ret);
    }
342692
public function execute($binPath = null, $args = null, $env = null)
    {
        if ($binPath !== null) {
            $this->binPath = $binPath;
        }

        if ($env !== null) {
            $this->env = $env;
        }

        if ($args !== null) {
            $this->args = $args;
        }
        $this->cmd = $this->binPath . static::buildArgs($this->args) . ($this->outputErrors ? ' 2>&1' : '');

        if (isset($this->setUser) || isset($this->setGroup)) {
            if (isset($this->setUser) && isset($this->setGroup) && ($this->setUser !== $this->setGroup)) {
                $this->cmd = 'sudo -g ' . escapeshellarg($this->setGroup) . '  -u ' . escapeshellarg($this->setUser) . ' ' . $this->cmd;
            } else {
                $this->cmd = 'su ' . escapeshellarg($this->setGroup) . ' -c ' . escapeshellarg($this->cmd);
            }
        }

        if ($this->chroot !== '/') {
            $this->cmd = 'chroot ' . escapeshellarg($this->chroot) . ' ' . $this->cmd;
        }

        if ($this->nice !== null) {
            $this->cmd = 'nice -n ' . ((int)$this->nice) . ' ' . $this->cmd;
        }

        $pipesDescr = [
            0 => ['pipe', 'r'], // stdin is a pipe that the child will read from
            1 => ['pipe', 'w'] // stdout is a pipe that the child will write to
        ];

        if (($this->errlogfile !== null) && !$this->outputErrors) {
            $pipesDescr[2] = ['file', $this->errlogfile, 'a']; // @TODO: refactoring
        }

        $this->pd = proc_open($this->cmd, $pipesDescr, $this->pipes, $this->cwd, $this->env);
        if ($this->pd) {
            $this->setFd($this->pipes[1]);
        }

        return $this;
    }
178669
protected function addCdr64Locator(): void
    {
        $cdr_offset = $this->ofs->add($this->cdr_ofs);

        $fields = [
            ['V', static::ZIP64_CDR_LOCATOR_SIGNATURE], // ZIP64 end of central file header signature
            ['V', 0x00],                                // Disc number containing CDR64EOF
            ['P', $cdr_offset],                         // CDR offset
            ['V', 1],                                   // Total number of disks
        ];

        $ret = static::packFields($fields);
        $this->send($ret);
    }