This file contains hidden or 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
-- find session boundaries | |
-- look at previous row timestamp, if more than 20 minutes ago, give that row a value of 1, else 0 | |
with session_start as ( | |
SELECT | |
CASE | |
WHEN timestamp - LAG(timestamp, 1, 0) OVER (PARTITION BY user_id, ORDER BY timestamp) > 1200000 -- 20 minutes | |
THEN 1 | |
ELSE 0 | |
END as session_boundary, | |
* |
This file contains hidden or 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
#SingleInstance force | |
; SQL | |
:*:ij`t::INNER JOIN ` | |
:*:loj`t::LEFT OUTER JOIN ` | |
:*:st`t::SHOW TABLES; | |
:*:sct`t::SHOW CREATE TABLE `;{left 1} | |
:*:scf`t::SELECT COUNT(*) FROM `;{left 1} | |
:*:ssf`t::SELECT * FROM `;{left 1} | |
:*:ldata`t::LOAD DATA INPATH '' OVERWRITE INTO TABLE '';{left 2} | |
:*:vddl`t::SELECT VIEW_DEFINITION FROM SYSIBM.VIEWS WHERE TABLE_SCHEMA = 'DB2' AND TABLE_NAME = ''{left 2} |
This file contains hidden or 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
// ==UserScript== | |
// @name YARN Cluster Prettyfication | |
// @namespace http://thedeetch.github.io | |
// @version 0.5 | |
// @description Prettyfier for YARN cluster web UI | |
// @author thedeetch | |
// @match *://*/cluster* | |
// @grant none | |
// @require http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.js | |
// ==/UserScript== |
This file contains hidden or 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 urllib, urllib2, cookielib | |
from bs4 import BeautifulSoup | |
import datetime | |
from time import sleep | |
import csv | |
def main(): | |
login_url = "http://192.168.100.1/goform/login" | |
status_url = "http://192.168.100.1/RgConnect.asp" |
This file contains hidden or 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
n = 0 | |
f = open("my_huge_file.txt", "r") | |
for line in f: | |
n+=1 | |
f.close() | |
print(n) | |
# 2m19.330s |