Skip to content

Instantly share code, notes, and snippets.

@haridsv
haridsv / After.png
Last active August 29, 2015 14:14
mcNewsSortOverlay.js: Show an overlay with a table of current news stories sorted by date on the MoneyControl portfolio news page.
After.png
@haridsv
haridsv / 1.error.txt
Last active August 29, 2015 14:20
OpenTSDB errors under load
2015-04-27 13:27:17,030 ERROR [New I/O worker #67] RegionClient: Uncaught error during de-serialization of MultiAction(batch=[PutRequest(table="tsdb", key=[0, 0, 22, 85, 27, -35, -64, 0, 0, 1, 0, 0, -64], family="t", qualifiers=[[17, -121]], values=[[0, 0, 0, 10, -64, 92, -47, 108]], timestamp=9223372036854775807, lockid=-1, durable=true, bufferable=true, attempt=2, region=RegionInfo(table="tsdb", region_name="tsdb,,1430141025970.93e30e6cb050703b91b3aae198c79e3c.", stop_key=[0, 0, 78, 85, 27, -105, 112, 0, 0, 1, 0, 0, -33, 0, 0, 13, 0, 0, 111, 0, 0, 14, 0, 0, 121, 0, 0, 15, 0, 0, 103, 0, 0, 16, 0, 0, 87])), PutRequest(table="tsdb", key=[0, 0, 29, 85, 27, -35, -64, 0, 0, 1, 0, 0, -64], family="t", qualifiers=[[17, -125]], values=[[0, 5, 18, 11]], timestamp=9223372036854775807, lockid=-1, durable=true, bufferable=true, attempt=2, region=RegionInfo(table="tsdb", region_name="tsdb,,1430141025970.93e30e6cb050703b91b3aae198c79e3c.", stop_key=[0, 0, 78, 85, 27, -105, 112, 0, 0, 1, 0, 0, -33, 0, 0, 13, 0, 0, 111, 0,
@haridsv
haridsv / 01.Exception.txt
Last active August 29, 2015 14:20
OpenTSDB error net.opentsdb.core.IllegalDataException: Found out of order or duplicate data for a row that seems to have cells that belong to a different hour than it is meant for. The hour corresponding to the row (from key) is "Tue, 05 May 2015 23:00:00 GMT" but it has cells for the hour "Tue, 05 May 2015 18:00:00 GMT".
net.opentsdb.core.IllegalDataException: Found out of order or duplicate data: last_delta=3225000, delta=3225000, offending KV=KeyValue(key=[0, 0, 93, 85, 73, 75, 112, 0, 0, 1, 0, 1, 47, 0, 0, 2, 0, 0, 40], family="t", qualifier=[-55, -111], value=[0, -88], timestamp=1430848824713), row=[KeyValue(key=[0, 0, 93, 85, 73, 75, 112, 0, 0, 1, 0, 1, 47, 0, 0, 2, 0, 0, 40], family="t", qualifier=[0, 1], value=[0, -116], timestamp=1430848806993), KeyValue(key=[0, 0, 93, 85, 73, 75, 112, 0, 0, 1, 0, 1, 47, 0, 0, 2, 0, 0, 40], family="t", qualifier=[0, -80], value=";", timestamp=1430866814036), KeyValue(key=[0, 0, 93, 85, 73, 75, 112, 0, 0, 1, 0, 1, 47, 0, 0, 2, 0, 0, 40], family="t", qualifier=[0, -16], value="p", timestamp=1430848807144), KeyValue(key=[0, 0, 93, 85, 73, 75, 112, 0, 0, 1, 0, 1, 47, 0, 0, 2, 0, 0, 40], family="t", qualifier=[1, -32], value="~", timestamp=1430848807144), KeyValue(key=[0, 0, 93, 85, 73, 75, 112, 0, 0, 1, 0, 1, 47, 0, 0, 2, 0, 0, 40], family="t", qualifier=[2, -112], value=";", timestamp=14
@haridsv
haridsv / 01.Exception.txt
Last active August 29, 2015 14:20
OpenTSDB error net.opentsdb.core.IllegalDataException: Found out of order or duplicate data for a row that has no cells of its own. The hour of the row is "Tue, 05 May 2015 13:00:00 GMT", but all cells are for the hour " Wed, 06 May 2015 10:47:00 GMT".
2015-05-08 11:59:28,205 ERROR [New I/O worker #9] HttpQuery: [id: 0x53f85b19, /10.204.22.80:63089 => /10.230.229.36:4242] Internal Server Error on /q?start=2015/04/01-00:00:00&end=2015/05/08-00:00:00&m=sum:1d-avg:proc.stat.cpu&o=&yrange=%5B0:%5D&wxh=1416x626&json
net.opentsdb.core.IllegalDataException: Found out of order or duplicate data: cell=Cell([-108, 39], [0, 0, 0, 8, 20, 123, -24, 61]), delta=2370000, prev cell=Cell([-108, 35], [3, -111, -121, 60]), last_delta=2370000, in row=[KeyValue(key=[0, 2, -116, 85, 72, -66, -48, 0, 0, 1, 0, 1, 47, 0, 0, 2, 0, 0, 38, 0, 0, 8, 0, 1, 53], family="t", qualifier=[0, 7, 0, -9, 1, -25, 2, -41, 3, -57, 4, -73, 5, -89, 6, -105, 7, -121, 8, 119, 9, 103, 10, 87, 11, 71, 12, 55, 13, 39, 14, 23, 15, 7, 15, -9, 16, -25, 17, -41, 18, -57, 19, -73, 20, -89, 21, -105, 22, -121, 23, 119, 24, 103, 25, 87, 26, 71, 27, 55, 28, 39, 29, 23, 30, 7, 30, -9, 31, -29, 32, -41, 33, -57, 34, -73, 35, -93, 36, -109, 37, -121, 38, 119, 39, 103, 40, 87, 41, 71, 42, 51, 43, 39, 44, 23, 45, 7,
class B(object):
@staticmethod
def identify():
return "B"
def iden(self):
return self.identify()
class D(B):
@staticmethod
@haridsv
haridsv / 01-esc-dot.py
Last active July 15, 2016 17:53 — forked from konradkonrad/01-esc-dot.py
restore yank-last-arg and yank-nth-arg in ipython 5
# ~/.ipython/profile_default/startup/01-esc-dot.py
from IPython import get_ipython
from prompt_toolkit.enums import DEFAULT_BUFFER
from prompt_toolkit.keys import Keys
from prompt_toolkit.filters import HasFocus, HasSelection, ViInsertMode, EmacsInsertMode
ip = get_ipython()
insert_mode = ViInsertMode() | EmacsInsertMode()
@haridsv
haridsv / docker-mount.sh
Last active August 12, 2016 16:39
Improved the script from https://jpetazzo.github.io/2015/01/13/docker-mount-dynamic-volumes/ to work with more scenarios. Save this file in the same directory as nsenter (https://github.com/jpetazzo/nsenter) and chmod +x it. This allows you to mount a host path on a running container. You may have to adjust the ownership of the mounted directory…
#!/bin/bash -e
# Based on https://jpetazzo.github.io/2015/01/13/docker-mount-dynamic-volumes/
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
[[ $# -eq 3 ]] || {
echo "Usage: $0 <container_name_or_id> <host_path> <container_path>" 1>&2
exit 1
}
@haridsv
haridsv / bookmarklet
Last active November 2, 2016 18:56
Copy all members of a chatter group. Click "Show All" and run the bookmarklet. See the member names in the console log.
javascript:s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='https://goo.gl/8V4KtP';void(0);
@haridsv
haridsv / bookmarklet
Last active November 4, 2016 13:10
Open Citibank India login dialog and set it right.
javascript:s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='https://goo.gl/e8GRr5';void(0);
@haridsv
haridsv / opencv_demo.py
Created October 7, 2011 00:16
Sample OpenCV 2.0 Python script to detect faces using a webcam
import sys
import cv
class FaceDetect():
def __init__(self):
cv.NamedWindow ("CamShiftDemo", 1)
device = 0
self.capture = cv.CaptureFromCAM(device)
capture_size = (320,200)
cv.SetCaptureProperty(self.capture, cv.CV_CAP_PROP_FRAME_WIDTH, capture_size[0])