Skip to content

Instantly share code, notes, and snippets.

View kavhad's full-sized avatar

Kaveh Hadjari kavhad

View GitHub Profile

Mathematical summation (Sigma):
=SUMPRODUCT(ROW(INDIRECT(A1&":"&B1) * 4 - 11)) //equals to sum y = x*4-11 from x = A1 to B1

Choose a in b:
=COMBIN(b, a)

Weighted sum:

@kavhad
kavhad / gist:a287e451d66e4d6195ed4d9ad0fdf951
Created November 2, 2017 21:18 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@kavhad
kavhad / client-side-SAML-passive-authentication.html
Last active January 28, 2016 08:36
passive SAML token (ADFS) re-authentication on client during jquery ajax loads
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8"/>
<link type="text/css" rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/black-tie/jquery-ui.css" />
</head>
<body>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
@kavhad
kavhad / get-all-table-size.sql
Created November 18, 2015 12:33
T-SQL, get all table size info
SELECT
t.NAME AS TableName,
s.Name AS SchemaName,
p.rows AS RowCounts,
SUM(a.total_pages) * 8 AS TotalSpaceKB,
SUM(a.used_pages) * 8 AS UsedSpaceKB,
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
FROM
sys.tables t
INNER JOIN