Skip to content

Instantly share code, notes, and snippets.

<?php
// По стандарту так
echo strtr($summaryText, array(
'{start}' => $start,
'{end}' => $end,
'{count}' => $total,
'{page}' => $pagination->currentPage + 1,
'{pages}' => $pagination->pageCount,
));
@WoZ
WoZ / gist:1810148
Created February 12, 2012 18:40 — forked from anonymous/gist:1810066
<?php
// ниже пример, когда существенно превышает длина строки 80 символов
// тут строка короче, но смысл тот же
// Вариант 1
if (! $memcache->waitForUnlock($mKey)
|| ! $b0 = $memcache->get($mKey)
) {
$memcache->log("$mKey unlocked but cache is empty");
$b0 = null;
@WoZ
WoZ / lvmbackup.sh
Created February 21, 2012 18:22
simple lvm backuper
#!/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
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'
<?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));
@WoZ
WoZ / mongophpdriver.php
Created October 17, 2012 11:05
PHP driver of MongoDB: test
<?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();
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});
@WoZ
WoZ / wowza_origin_edge_retries.log
Created May 11, 2017 10:43
wowza_origin_edge_retries.log
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] - -
@WoZ
WoZ / dts_and_realtime.gp
Created January 4, 2018 08:53
Gnuplot script for ffprobe analysis
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
diff -upr linux-2.6.32-696.18.7.el6.orig/drivers/net/tg3.c linux-2.6.32-696.18.7.el6-042stab127_2/drivers/net/tg3.c
--- linux-2.6.32-696.18.7.el6.orig/drivers/net/tg3.c 2017-12-29 01:55:16.000000000 +0300
+++ linux-2.6.32-696.18.7.el6-042stab127_2/drivers/net/tg3.c 2018-01-04 15:28:20.074107990 +0300
@@ -234,6 +234,11 @@ static int tg3_debug = -1; /* -1 == use
module_param(tg3_debug, int, 0);
MODULE_PARM_DESC(tg3_debug, "Tigon3 bitmapped debugging message enable value");
+static int tg3_pcie_mrrs_boost = 0;
+module_param(tg3_pcie_mrrs_boost, int, S_IRUGO);
+MODULE_PARM_DESC(tg3_pcie_mrrs_boost, "Increase Tigon3 PCI MRRS "