public static function show($msg = '') { $pre = false; if (self::$last) { $pre = self::$last; } self::$last = self::memoryGetUsage(); $data = self::$last; $txt = humanFileSize($data['mem']); if ($pre) { $mem = $data['mem'] - $pre['mem']; $mem = ($mem < 0 ? '-' : '+') . humanFileSize(abs($mem)); $txt .= "\t\t\t Delta : " . $mem; } echo "MemoryUsage : \t" . chr(27) . "[33m" . $txt . "[0m " . ($msg ? ' <<< ' . $msg : '') . "\n"; }
</a> </td> <td><input type="text" value="<?php echo $file->name; ?> " data-id="<?php echo $file->id; ?> " class="file_name_edit form-control"/></td> <td><?php echo $file->type; ?> </td> <td><?php echo humanFileSize($file->size); ?> </td> <?php if ($file->module_name == 'partners_logo') { ?> <td> <form class="ajax-auto-submit" action='<?php echo url('home/postsaveord'); ?> ' method="post"><input type="number" name="order" class="form-control" value="<?php echo $file->ord; ?> "> <input type="hidden" name="id" value='<?php
\t\t<div class="panel-heading"><h3 class="panel-title"><span class="glyphicon glyphicon-time"></span> View analysis later</h3></div> \t\t<div class="panel-body">Access your results later at the following address:<br/><br/><textarea class="input-sm permalink">{$permalink}</textarea></div> \t</div> PANEL; // -- Panel to show user's last analysis, if any ------------------------------- if (file_exists(DIR_UPLOADS . '/' . $GINKGO_USER_ID . '/status.xml')) { $PANEL_PREVIOUS = <<<PANEL \t<!-- Panel: View previous analysis results --> \t<div class="panel panel-primary"> \t\t<div class="panel-heading"><h3 class="panel-title"><span class="glyphicon glyphicon-stats"></span> Previous analysis results</h3></div> \t\t<div class="panel-body">See your <a href="?q=results/{$GINKGO_USER_ID}">previous analysis results</a>.<br/><br/><strong>Note</strong>: Running another analysis will overwrite previous results.</div> \t</div> PANEL; } // -- Panel for downloading tree ----------------------------------------------- $dloadFileSizes = array('SegStats' => humanFileSize("{$userDir}/SegStats"), 'SegBreaks' => humanFileSize("{$userDir}/SegBreaks"), 'SegCopy' => humanFileSize("{$userDir}/SegCopy"), 'SegNorm' => humanFileSize("{$userDir}/SegNorm"), 'SegFixed' => humanFileSize("{$userDir}/SegFixed"), 'CNV1' => humanFileSize("{$userDir}/CNV1"), 'CNV2' => humanFileSize("{$userDir}/CNV2")); $rnd = rand(1000000.0, 2000000.0); $PANEL_DOWNLOAD = <<<PANEL \t<!-- Panel: Download results --> \t<div id="results-download" class="panel panel-default" style="display:none;"> \t\t<div class="panel-heading"><span class="glyphicon glyphicon-tree-deciduous"></span> Tree display</div> \t\t<!-- Table --> \t\t<table class="table" style="font-size:12.5px;"> \t\t\t<tr class="active"><td><input type="radio" name="results-tree-view" onclick="javascript:drawTree('clust.xml');" checked> <strong>Normalized read counts</strong> (<a target="_blank" href="{$userUrl}/clust.newick">newick</a> | <a target="_blank" href="{$userUrl}/clust.xml">xml</a> | <a target="_blank" href="{$userUrl}/clust.pdf">pdf</a> | <a target="_blank" href="{$userUrl}/clust.jpeg">jpeg</a>)</td></tr> \t\t\t<tr class="active"><td><input type="radio" name="results-tree-view" onclick="javascript:drawTree('clust2.xml');"> <strong>Copy-number</strong> (<a target="_blank" href="{$userUrl}/clust2.newick">newick</a> | <a target="_blank" href="{$userUrl}/clust2.xml">xml</a> | <a target="_blank" href="{$userUrl}/clust2.pdf">pdf</a> | <a target="_blank" href="{$userUrl}/clust2.jpeg">jpeg</a>)</td></tr> \t\t\t<tr class="active"><td><input type="radio" name="results-tree-view" onclick="javascript:drawTree('clust3.xml');"> <strong>Correlations</strong> (<a target="_blank" href="{$userUrl}/clust3.newick">newick</a> | <a target="_blank" href="{$userUrl}/clust3.xml">xml</a> | <a target="_blank" href="{$userUrl}/clust3.pdf">pdf</a> | <a target="_blank" href="{$userUrl}/clust3.jpeg">jpeg</a>)</td></tr> \t\t</table> \t</div> \t<div id="results-download2" class="panel panel-default" style="display:none;"> \t\t<div class="panel-heading"><span class="glyphicon glyphicon-file"></span> Download processed data</div>
echo $group["name"]; ?> </code> --> <code class="file-creation"><?php echo $creationDate->format("Y-m-d H:i:s"); ?> </code> <!-- <code class="file-modification"><?php echo $modificationDate->format("Y-m-d H:i:s"); ?> </code> --> <code class="file-size"><?php echo humanFileSize($filesize, false); ?> </code> </li> <?php } ?> </ul> </div> </div> <div class="lastDiv"></div> <templates>
<div class="row"> <div class="col-sm-3"><h4 id="uploadCase"><span class="glyphicon glyphicon-upload" aria-hidden="true"></span><span class="sr-only">Warning:</span> Select file to upload >>></h4></div> <div class="col-sm-6"><input type="file" name="fileToUpload" id="fileToUpload"></div> <div class="col-sm-3"><button name="submit" class="btn btn-warning btn-xs" value="uploading">Upload Package</button></div> </div> </div> </form> <?php if ($handle = opendir($dir)) { echo ' <table role="presentation" class="table table-striped"><tbody class="files">'; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != ".gitignore") { echo ' <tr class="template-download fade in">'; echo ' <td><span class="preview"></span></td>'; echo ' <td><p class="name">' . $file . '</p></td>'; echo ' <td><p class="size">' . humanFileSize(filesize($dir . $file), "KB") . '</p></td>'; echo ' <td style="width:220px"><form class="form" style="display:inline;" action="updater.php" method="post">'; echo ' <input type="hidden" name="input-file" value="' . $file . '">'; echo ' <button name="submit" class="btn btn-danger delete" style="width:95px" value="delete-file"><i class="glyphicon glyphicon-trash"></i> Delete</button></form>'; echo ' <form class="form" style="display:inline;" action="updateRunner.php" method="post"><input type="hidden" name="input-file" value="' . $file . '"><button name="submit" class="btn btn-primary" style="width:95px" value="update-sexigraf"><i class="glyphicon glyphicon-cog"></i> Upgrade</button>'; echo ' </form></td></tr>'; } } closedir($handle); echo ' </tbody></table>'; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { switch ($_POST["submit"]) { case "uploading": $errorUploadHappened = false; if ($_FILES['fileToUpload']['error'] > 0) {
function php_file_tree_top_oldest($directory, $topn) { $display = array('wsp'); $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)); $data = array(); $php_file_tree = ""; foreach ($files as $file) { $time = DateTime::createFromFormat('U', filemtime($file->getPathname())); if (in_array($file->getExtension(), $display)) { $data[] = array('filename' => $file->getPathname(), 'size' => $file->getSize(), 'time' => $time->getTimestamp()); } } usort($data, function ($a, $b) { // sort by time oldest return $a['time'] - $b['time']; }); $i = 0; $php_file_tree = "<ul class=\"php-file-tree\">"; foreach ($data as $key => $value) { if (++$i == $topn) { break; } $time = date('Y-m-d H:i:s', $value['time']); $filenamevalue = $value['filename']; $php_file_tree .= "<li class=\"pft-file\"><input type=\"checkbox\" name=\"pathChecked[]\" value=\"{$filenamevalue}\"> <strong>" . htmlspecialchars(str_replace($directory . "/", "", $value['filename'])) . "</strong> (" . humanFileSize($value['size']) . " | {$time})</li>"; } $php_file_tree .= "</ul>"; return $php_file_tree; }
$description = $_POST['description']; // humanFileSize function to make bytes to KB/MB/GB unit function humanFileSize($size, $unit = "") { if (!$unit && $size >= 1 << 30 || $unit == "GB") { return number_format($size / (1 << 30), 2) . "GB"; } if (!$unit && $size >= 1 << 20 || $unit == "MB") { return number_format($size / (1 << 20), 2) . "MB"; } if (!$unit && $size >= 1 << 10 || $unit == "KB") { return number_format($size / (1 << 10), 2) . "KB"; } return number_format($size) . " bytes"; } $file_size = humanFileSize($file_size); // check to see if file is already uploaded or file name is duplicate if (file_exists($file_path)) { $error[] = "File already exists"; } // check to see if file is larger than 15MB if ($file['size'] > 14865981) { $error[] = "Sorry, your file is too large."; } if (!isset($error)) { // if validation passes then move the uploaded file to target folder if (move_uploaded_file($file_tmp, $file_path)) { // give success message to the user $success = "Your <strong>" . $file_name . "</strong> file has been uploaded."; // escaping string avoiding SQL injection $file_name = mysql_real_escape_string($file_name);
<span class="label label-primary"><i class="fa fa-file"></i> <?php echo $filetype; ?> </span> <?php if ($subfoldername) { ?> <span class="label label-warning"><i class="fa fa-folder"></i><?php echo ' ' . $subfoldername; } ?> </span> </div> <div class="font-s13 text-muted hidden-xs"> <p><?php echo humanFileSize($filesrow['file_size']); ?> </p> </div> </td> <td class="visible-lg text-muted text-center"><em>Uploaded <?php echo time_elapsed('@' . $filesrow['file_last_edit']); ?> </em></td> <td class="text-center"> <!-- NEW ACTIONS --> <form method="post" action="files.php?u=<?php echo $_GET['u'] . '&folder=' . $_GET['folder']; ?> "> <input type="hidden" name="thisisfile" id="thisisfile" readonly value="<?php
<span class="col-md-2 download" data-size="<?php echo $interface["in"]; ?> "><?php echo humanFileSize($interface["in"], false); ?> /s</span> <label class="col-md-2"><?php echo lang("index_network_upload_label"); ?> </label> <span class="col-md-2 upload" data-size="<?php echo $interface["out"]; ?> "><?php echo humanFileSize($interface["out"], false); ?> /s</span> </div> <?php } ?> <?php } ?> </fieldset> </div> </div> </div>
$req = array('action' => 'sendMessage', 'data' => array('text' => 'Sorry, we can\'t find a file with that ID. Either a typo was made or it was deleted already.')); } } break; // list command // list command case '/list': $count = $db->querySingle('SELECT COUNT(`id`) FROM `rfiles_bot` WHERE `uploader` = "' . $post['from']['id'] . '"'); if ($count == 0) { $req['data']['text'] = 'You haven\'t shared any files yet.'; } else { $files = $db->query('SELECT `id`,`file_name`,`file_size` FROM `rfiles_bot` WHERE `uploader` = "' . $post['from']['id'] . '"'); $req['data']['text'] = 'Your files : ' . "\n"; $i = 1; while ($file = $files->fetchArray()) { $req['data']['text'] .= $i . '. <a href="https://telegram.me/' . $config['bot_username'] . '?start=' . $file['id'] . '">' . htmlspecialchars($file['file_name']) . '</a> (' . humanFileSize($file['file_size']) . ') - <b>ID: ' . $file['id'] . '</b>' . "\n"; $i++; } } $req['action'] = 'sendMessage'; $req['data']['parse_mode'] = 'html'; break; // delete command // delete command case '/delete': if (empty($ex[1])) { $req['data']['text'] = "/delete <b><FILE ID></b>\nTo see FILE ID: /list"; } else { $count = $db->querySingle('SELECT COUNT(`id`) FROM `rfiles_bot` WHERE `uploader` = "' . $post['from']['id'] . '" AND `id` = "' . SQLite3::escapeString($ex[1]) . '"'); if ($count == 0) { $req['data']['text'] = 'Sorry, you haven\'t a file with that <b>ID</b>';
<?php require __DIR__ . '/../vendor/autoload.php'; include 'ExampleTools.php'; $consumerKey = $_SERVER['argv'][1]; $consumerSecret = $_SERVER['argv'][2]; $accessToken = $_SERVER['argv'][3]; $tokenSecret = $_SERVER['argv'][4]; $cloudPath = $_SERVER['argv'][5]; // Create a cloud api connection to copy $ca = new \Barracuda\Copy\API($consumerKey, $consumerSecret, $accessToken, $tokenSecret); print "Listing {$cloudPath}\n"; $children = $ca->listPath($cloudPath); foreach ($children as $child) { printf("%5.5s %10.10s ", $child->{"type"}, humanFileSize($child->{"size"})); echo basename($child->{"path"}) . PHP_EOL; }
<tr id="server-<?php echo $server["vse_id"]; ?> " data-bandwidth="<?php echo $server["vse_bandwidth"]; ?> "> <td><?php echo $server["vse_label"]; ?> </td> <td><?php echo lang("servers_server_description"); ?> : <?php echo str_replace("iB", "b", humanFileSize($server["vse_bandwidth"] * 8, false, 0)); ?> ps</td> <td class="users text-right">0</td> <td class="used-capacity"> <div class="progress"> <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%; text-shadow: -1px -1px 0 #888, 1px -1px 0 #888, -1px 1px 0 #888, 1px 1px 0 #888;"> <span style="position: relative; left: 2px;">0.0%</span> </div> </div> </td> </tr> <?php } ?>
<?php include_once __DIR__ . '/../include.php'; include_once __DIR__ . '/lib_example.php'; // load production config $config = (include_once __DIR__ . '/../../_clickhouse_config_product.php'); $cl = new ClickHouseDB\Cluster($config); $cl->setScanTimeOut(2.5); // 2500 ms $cl->setSoftCheck(true); if (!$cl->isReplicasIsOk()) { throw new Exception('Replica state is bad , error=' . $cl->getError()); } $tables = $cl->getTables(); foreach ($tables as $dbtable => $tmp) { echo ">>> {$dbtable} :"; $size = $cl->getSizeTable($dbtable); echo "\t" . humanFileSize($size) . "\n"; } $table_for_truncate = 'target.events_sharded'; $result = $cl->truncateTable($table_for_truncate); echo "Result:truncate table\n"; print_r($result); echo "\n----\nEND\n"; // ----------------------------------------------------------------------