View gist:1801613
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// По стандарту так | |
echo strtr($summaryText, array( | |
'{start}' => $start, | |
'{end}' => $end, | |
'{count}' => $total, | |
'{page}' => $pagination->currentPage + 1, | |
'{pages}' => $pagination->pageCount, | |
)); |
View gist:1810148
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ниже пример, когда существенно превышает длина строки 80 символов | |
// тут строка короче, но смысл тот же | |
// Вариант 1 | |
if (! $memcache->waitForUnlock($mKey) | |
|| ! $b0 = $memcache->get($mKey) | |
) { | |
$memcache->log("$mKey unlocked but cache is empty"); | |
$b0 = null; |
View lvmbackup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Dmitry Menshikov <d.menshikov@creators.com.ua> | |
# http://menshikov.mp | |
PATH_TO_VG="/dev/mainvg" | |
BACKUP_PATH="/media/Reservation/.backups/zoidberg" | |
BACKUP_PATH=$BACKUP_PATH/`date +"%d_%m_%Y"` | |
if [[ $EUID -ne 0 ]]; then | |
echo "You must be a root user" 2>&1 |
View gist:2024596
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('memory_limit', '8192M'); | |
$iterations = 10000000; | |
$data = array(); | |
for ($i = 0; $i < $iterations; $i++) { | |
$data['iteration' . $i] = array(); | |
} | |
echo sprintf("Memory used: %0.2f MB\n", memory_get_peak_usage(true) / floatval(1024 * 1024)); |
View gist:2024604
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import resource | |
iterations = 10000000 | |
data = {} | |
for i in xrange(0, iterations): | |
data['iteration' + str(i)] = [] | |
memoryUsed = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024.0 | |
print "Memory used: ", str(round(memoryUsed, 2)) + 'MB' |
View mongophpdriver.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$c = new Mongo(); | |
$db = $c->demo; | |
$db->bugs->drop(); | |
var_dump(PHP_INT_MAX); | |
$db->demo->bugs->insert(array('foo' => PHP_INT_MAX)); | |
$db->demo->bugs->findOne(); |
View gist:5319372
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var amqp = require('amqp'); | |
var exchangeName = 'nonpresent.exchange'; | |
var connection = amqp.createConnection({host: 'localhost'}); | |
connection.on('ready', function() { | |
connection.on('error', function(err) { | |
console.log('connection error:', err); | |
}); | |
var exch = connection.exchange(exchangeName, {passive: true}); |
View wowza_origin_edge_retries.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2017-05-09 20:51:49 UTC comment server WARN 200 - LiveMediaStreamReceiver.doWatchdog: streamTimeout[origin/_definst_/51881f4ba218c305419d91c3cd56197c_bc2_hd]: Resetting connection: wowz://10.2.1.239:1935/origin/_definst_/51881f4ba218c305419d91c3cd56197c_bc2_hd - - - 4280289.269 - - - - - - - - - - - - - - - - - - - - - - - - - | |
2017-05-09 20:51:49 UTC comment server INFO 200 - LiveMediaStreamReceiver.resetConnection: SSL:false url:wowz://10.2.1.239:1935/origin/_definst_/51881f4ba218c305419d91c3cd56197c_bc2_hd - - - 4280289.27 - - - - - - - - - - - - - - - - - - - - - - - - - | |
2017-05-09 20:51:49 UTC comment server INFO 200 - CupertinoStreamerLiveRepeaterReceiver.resetStream[edge/_definst_/wowz#3A#2F#2F10.2.1.239#3A1935#2Forigin#2F51881f4ba218c305419d91c3cd56197c_bc2_hd:cupertinostreamingpacketizer] - - - 4280289.27 - - - - - - - - - - - - - - - - - - - - - - - - - | |
2017-05-09 20:51:49 UTC comment server INFO 200 - LiveMediaStreamReceiver.sessionClosed[origin/_definst_/51881f4ba218c305419d91c3cd56197c_bc2_hd] - - |
View ffprobe_analyzer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const readline = require('readline'); | |
const fs = require('fs'); | |
const argv = process.argv.slice(2); | |
if (argv.length !== 1) { | |
console.error('Invalid list of arguments'); | |
process.exit(1); | |
} | |
const filename = argv[0]; |
View dts_and_realtime.gp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reset | |
set ylabel "Frames in period" | |
set xlabel "Time" | |
set xdata time | |
set timefmt "%s" | |
set format x "%H:%M:%S" | |
set grid | |
set style line 1 lc rgb '#388e3c' lt 1 lw 1 pt 5 ps 0.5 | |
set style line 2 lc rgb '#6a1b9a' lt 1 lw 1 pt 5 ps 0.5 |
OlderNewer