Skip to content

Instantly share code, notes, and snippets.

View gunlee01's full-sized avatar

Gunhee Lee gunlee01

View GitHub Profile
@gunlee01
gunlee01 / user-timing-rum.js
Last active August 29, 2015 14:26 — forked from pmeenan/user-timing-rum.js
Support routine for adding W3C user timing events to a site. Includes some basic polyfill support for browsers that don't support user timing or navigation timing (though the start time for non-navigation timing support could be improved with IE < 9 to use IE's custom start event).
// Support routines for automatically reporting user timing for common analytics platforms
// Currently supports Google Analytics, Boomerang and SOASTA mPulse
// In the case of boomerang, you will need to map the event names you want reported
// to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable:
// rumMapping = {'aft': 'custom0'};
(function() {
var wtt = function(n, t, b) {
t = Math.round(t);
if (t >= 0 && t < 3600000) {
// Google Analytics
@gunlee01
gunlee01 / intercept.js
Last active August 29, 2015 14:26 — forked from suprememoocow/intercept.js
AJAX timing interceptor: this class intercepts all AJAX calls and records the time taken for the HTTP request to complete. These timings are posted back to the server in batches, if there are any to send, about every two seconds. Tested in Firefox, Chrome
(function(XHR) {
"use strict";
var stats = [];
var timeoutId = null;
var open = XHR.prototype.open;
var send = XHR.prototype.send;
@gunlee01
gunlee01 / get_home.bat
Created December 25, 2015 13:30 — forked from djangofan/get_home.bat
DOS batch file to find JAVA_HOME
@ECHO OFF
:: ------------------------------------------------------------------
:: JavaHome.bat - search for and set JAVA_HOME
:: 1. If JAVA_HOME is set in system environment, do nothing else.
:: 2. If javahome.txt already exists, use that value
:: 3. If those fail, search parent directories for java.exe
:: 4. Finally, try looking in the registry for other Java installations
:: Note- Script does not add trailing slash to JAVA_HOME variable
:: Note- JBINARY var can be set to JRE or JDK detection
:: ------------------------------------------------------------------
@gunlee01
gunlee01 / install-influxdb.sh
Created April 1, 2016 08:54
influxdb install on max OS X
brew update
brew install influxdb
@gunlee01
gunlee01 / BizSampleAgent.java
Created September 7, 2016 14:07
BizSampleAgent
package scouterx.pulse.sample.bizcounter;
import scouterx.pulse.common.http.HttpTrain;
import scouterx.pulse.common.protocol.register.CounterDef;
import scouterx.pulse.common.protocol.register.ObjectDef;
import scouterx.pulse.common.protocol.register.RegisterBean;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@gunlee01
gunlee01 / http-logging-lambda.js
Last active December 20, 2016 15:48
http logging lambda
'use strict';
exports.handler = (event, context, callback) => {
console.log("[EventLog-ByLineCall]");
console.log(event);
const done = (err, res) => callback(null, {
statusCode: err ? '400' : '200',
body: err ? (err.message || err) : JSON.stringify(res),
headers: {
'Content-Type': 'application/json',
curl -X POST \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer {ENTER_ACCESS_TOKEN}' \
-d '{
"to": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"messages":[
{
"type":"text",
"text":"Hello, world1"
},
ext_plugin_line_send_alert=true
ext_plugin_line_access_token=Tl++IYUAOdtcHQfr7+3ieTIQs8/M9DTdBIrrwkm58KzuX03paU3gq8hxUrAA7NTERS3PJ9n8Q2=
ext_plugin_line_group_id=C0246cfsdf6599ec6ddesdf12bec77eb4a
@gunlee01
gunlee01 / hashUtil.js
Created May 17, 2018 09:31
Scouter Hash util by javascript
const table = [
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
@gunlee01
gunlee01 / alert1.java
Last active May 23, 2018 00:15
scouter alert scripting #1
float value = $counter.getFloatValue();
if(value > 2000) {
$counter.fatal("Alert title", "msg: Elapsed is over 2000ms");
}