Skip to content

Instantly share code, notes, and snippets.

Avatar

Hari Krishna Dara haridsv

View GitHub Profile
@haridsv
haridsv / ghPRExpandAllMyComments.js
Created Jul 21, 2020
Expand all the comments made by the current user (handles only those that are part of a review submission).
View ghPRExpandAllMyComments.js
var currentUser = document.querySelector(".user-profile-link").href.replace(/.*\//, "")
document.querySelectorAll("div.js-comment.js-targetable-comment.js-updatable-content").forEach(function(n) {
var authorNode = n.parentNode.querySelector(".author");
if (authorNode && authorNode.textContent == currentUser) {
n.parentNode.querySelectorAll(".js-toggle-outdated-comments").forEach(n => n.click());
}
})
@haridsv
haridsv / ghPRExpandAll-bookmarklet
Last active Jul 3, 2020
Expand all pages ("Load more..." buttons) in a Github PR conversation view.
View ghPRExpandAll-bookmarklet
NOTE: Doesn't work because of github CSP meta tags.
javascript:s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='https://git.io/JJTwA';void(0);
@haridsv
haridsv / bookmarklet
Last active Nov 4, 2016
Open Citibank India login dialog and set it right.
View bookmarklet
javascript:s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='https://goo.gl/e8GRr5';void(0);
@haridsv
haridsv / bookmarklet
Last active Nov 2, 2016
Copy all members of a chatter group. Click "Show All" and run the bookmarklet. See the member names in the console log.
View bookmarklet
javascript:s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='https://goo.gl/8V4KtP';void(0);
@haridsv
haridsv / docker-mount.sh
Last active Aug 12, 2016
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…
View docker-mount.sh
#!/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 / 01-esc-dot.py
Last active Jul 15, 2016 — forked from konradkonrad/01-esc-dot.py
restore yank-last-arg and yank-nth-arg in ipython 5
View 01-esc-dot.py
# ~/.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 / note.md
Created Jun 6, 2016
Cause of "Failed to renew token: Kind: HDFS_DELEGATION_TOKEN"
View note.md

One of the reasons that this failure occurs is because of the incorrect client setting of yarn.resourcemanager.cluster-id that ends up not matching the one in the cluster. This often results in a cryptic error that looks like this:

Failed to renew token: Kind: HDFS_DELEGATION_TOKEN, Service: ha-hdfs:test-local-EMPTY, Ident: (HDFS_DELEGATION_TOKEN token 40242 for hari)

Unfortunately, the original IOException seems to get completely lost, neither logged on the server nor gets seen on the client. When I put an extra trace log line to print the exception, I got this:

2016-06-06 12:57:57,394 ERROR [tionTokenRenewer #50] security.DelegationTokenRenewer - Failed to renew token: Kind: HDFS_DELEGATION_TOKEN, Service: ha-hdfs:test-local-EMPTY, Ident: (HDFS_DELEGATION_TOKEN token 40663 for sfdc)
java.io.IOException: Unable to map logical nameservice URI 'hdfs://test-local-EMPTY' to a NameNode. Local configuration does not have a failover proxy provider configured.
        at org.apache.hadoop.hdfs.DFSCl
@haridsv
haridsv / hbase_shell_snippets.md
Last active Jun 22, 2019
Decode byte strings from HBase shell, a collection of snippets
View hbase_shell_snippets.md
hbase(main):002:0> T = create 'emp',  {NAME => 'f', VERSIONS => 5}
0 row(s) in 1.1300 seconds

=> Hbase::Table - emp
hbase(main):003:0> T.put '001', 'f:name', 'Tom'
0 row(s) in 0.0890 seconds
hbase(main):003:0> T.put '001', 'f:name', 'Tom Too'
0 row(s) in 0.0890 seconds
@haridsv
haridsv / bookmarklet
Last active Jun 16, 2017
Paste Enabler, remove attributes from form text fields that restrict copy and paste operations. Tested to be working on many financial websites, though on some it causes duplication (workaround: undo).
View bookmarklet
javascript:s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='https://goo.gl/OrQlxL';void(0);
@haridsv
haridsv / 01.Exception.txt
Last active Aug 29, 2015
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".
View 01.Exception.txt
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,
You can’t perform that action at this time.