Skip to content

Instantly share code, notes, and snippets.

View bobrik's full-sized avatar

Ivan Babrou bobrik

View GitHub Profile
@bobrik
bobrik / jstack-1.txt
Created May 12, 2015 08:23
jstack for marathon
2015-05-12 08:19:17
Full thread dump OpenJDK 64-Bit Server VM (24.79-b02 mixed mode):
"Attach Listener" daemon prio=10 tid=0x00007f09dc00e800 nid=0xd4d waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"pool-3-thread-96" prio=10 tid=0x00007f0948046000 nid=0xd3a waiting on condition [0x00007f0911262000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x000000078421f1f0> (a java.util.concurrent.SynchronousQueue$TransferStack)
@bobrik
bobrik / flamegraph-0.8.1-RC1.svg
Created May 14, 2015 09:42
marathon flamegraphs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bobrik
bobrik / v0.8.1-RC1.json
Created May 21, 2015 14:05
marathon metrics
{
"timers": {
"org.eclipse.jetty.servlet.ServletContextHandler.trace-requests": {
"rate_units": "calls/second",
"p98": 0,
"p95": 0,
"p75": 0,
"p50": 0,
"min": 0,
"mean": 0,
@bobrik
bobrik / metrics.json
Created May 27, 2015 09:39
marathon pr-1568 (10min)
{
"timers": {
"service.mesosphere.marathon.tasks.TaskTracker$$EnhancerByGuice$$c9257ec9.timeout": {
"rate_units": "calls/second",
"p98": 1.61442e-06,
"p95": 1.3412499999999997e-06,
"p75": 5.77e-07,
"p50": 3.505e-07,
"min": 3.9000000000000005e-08,
"mean": 4.941150684931507e-07,
web351 ~ # ps aux | grep [4]8174
www 48174 2.3 0.3 84536 25136 ? S 11:35 7:11 nginx: worker process is shutting down
web351 ~ # netstat -ntp | fgrep ESTABLISHED | fgrep 48174 | wc -l
308
web351 ~ # netstat -ntp | fgrep ESTABLISHED | fgrep 48174 | wc -l
308
web351 ~ # netstat -ntp | fgrep ESTABLISHED | fgrep 48174 | wc -l
308
web351 ~ # netstat -ntp | fgrep ESTABLISHED | fgrep 48174 | wc -l
309
-# если вы дурак^W как я, и на руби пишете
-# в основном в состоянии расширенного сознания,
-# то вот вам пример, как делать условия в haml:
- if myfreakingvar == 'omg'
%p My freaking var is "omg". OMG!
-# штука в том, что строки, начинающиеся с «-»,
-# выполняются как ruby код, а всё, что уровнем
-# «ниже» по «дереву» - оборачивается в do .. end
@bobrik
bobrik / lazy_map.py
Created October 20, 2010 15:38
lazy map variant for python
#!/usr/bin/python
def lazy_map(func, *sequences):
"""
Ленивая реализация map, делающая вызовы только при необходимости
получения результата, т.е. итерации возвращаемого генератора.
При множественном вызове получается чистая композиция функций, т.е.
lazy_map(lambda: x+1, lazy_map(lambda x: x+2, [1, 2, 3]))
@bobrik
bobrik / memcached-0.1.5-compatibility.patch
Created October 12, 2011 10:04
memcached module for php with backward compatibility hacks
diff --git a/php_memcached.c b/php_memcached.c
index aecdc4f..7ad6c0d 100644
--- a/php_memcached.c
+++ b/php_memcached.c
@@ -115,17 +115,17 @@ typedef unsigned long int uint32_t;
/****************************************
Payload value flags
****************************************/
-#define MEMC_VAL_TYPE_MASK 0xf
+#define MEMC_VAL_TYPE_MASK 0x2f
@bobrik
bobrik / Spawner.js
Created October 13, 2011 15:55
es5 inheritance
exports.spawn = function(parent, props) {
var key,
defs = {
_parent: { value: parent, enumerable: true }
};
for (key in props) {
if (props.hasOwnProperty(key)) {
defs[key] = {
value : props[key],
var twitter = require("ntwitter");
var ids = [284428360, 402607050, 14804140, 277829354, 184294175, 42931729, 66639438, 323618468,
315293821, 216261487, 64943419, 225771382, 397325621, 12067, 33495086, 222724928,
380661817, 28173504, 352674217, 183498392, 364038471, 161040541, 174672057, 129393710,
365406840, 29401562, 289940460, 298569251, 334544358, 284277979, 15953589, 324054488,
202629571, 71270409, 374156510, 14254332, 138206836, 19673977, 98792531, 386035729,
396548403, 160485521, 220606092, 42210677, 11029332, 184653870, 375251876, 322264568,
279906350, 374548190, 340684743, 258261357, 44394854, 132842469, 21283969, 137171866,
390602925, 84521296, 69276297, 387440969, 265980979, 65638508, 118425429, 148287455,