Skip to content

Instantly share code, notes, and snippets.

View HariSekhon's full-sized avatar
🏠
Digital Nomad

Hari Sekhon HariSekhon

🏠
Digital Nomad
View GitHub Profile
@HariSekhon
HariSekhon / compare_buckets.py
Created October 18, 2019 14:36 — forked from tomkinsc/compare_buckets.py
This is a quick and dirty script to compare two different s3-compatible buckets, just dorp in the bucket name and credentials, and optionally change the endpoint host
#!/usr/bin/python
import boto, json
from boto.s3.connection import S3Connection
from boto.gs.connection import GSConnection
def compare_buckets(bucket_one_bucket_name,
bucket_two_bucket_name,
bucket_one_access_key_id,
@HariSekhon
HariSekhon / check_hbase_onlineregions.sh
Created December 24, 2018 10:57 — forked from ashrithr/check_hbase_onlineregions.sh
nagios plugin for hbase to check how many regions a region server is serving and throw critical if regions > 90
#!/usr/bin/env bash
#Author: Ashrith
#Arrays to store hosts and their regionsOnLine respectively
declare -a HOSTS_ARRAY
declare -a REGIONS_ARRAY
message=""
EXIT_STATUS=0
@HariSekhon
HariSekhon / tsdb_delete_old.sh
Created October 15, 2018 09:01 — forked from d10v/tsdb_delete_old.sh
opentsdb delete old data
#!/bin/bash
set -o nounset
set -o errexit
set -o pipefail
EXTRA_TAGS=${1}
TSDB_CMD=$( /usr/bin/which tsdb )
START_TIME="1y-ago"
END_TIME="45d-ago"
@HariSekhon
HariSekhon / opentsdb_delete_old_data.sh
Created July 11, 2018 15:56 — forked from d10v/opentsdb_delete_old_data.sh
Delete old data from OpenTSDB using `scan --delete`
#!/bin/bash
set -o nounset
set -o errexit
set -o pipefail
TSDB_CMD=$( /usr/bin/which tsdb )
START_TIME="1y-ago"
END_TIME="21d-ago"
SLEEP=10
/* Expected exposure is the expected (average) credit exposure conditional on positive market values */
def expectedExposure(marketValues: Seq[Double]): Double = {
val exposures = marketValues.filter(_ > 0f)
if (exposures.size == 0) 0.0
else exposures.sum / exposures.size
}
/* A high percentile (95%) of the distribution of exposures at any particular future date. Also called Peak Exposure (PE) */
def potentialFutureExposure(marketValues: Seq[Double], confidenceLevel: Double): Double = {
val exposures = marketValues.filter(_ > 0)
#Install R and then following packages
#repr failed to create
yum install R-*
install.packages("evaluate", dependencies = TRUE)
install.packages("base64enc", dependencies = TRUE)
install.packages("devtools", dependencies = TRUE)
install_github('IRkernel/repr')
install.packages("dplyr", dependencies = TRUE)
install.packages("caret", dependencies = TRUE)
install.packages("repr", dependencies = TRUE)