Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Amit Hegde amithegde

🎯
Focusing
View GitHub Profile
@amithegde
amithegde / README.md
Last active Apr 14, 2016
Custom stacked row chart
View README.md

Built with blockbuilder.org

This chart renders custom stacked row chart to represent bunch of servers, their up time and health level at different intervlas

@amithegde
amithegde / CaptureEtw.cs
Created Jan 28, 2016
capturing EWT events
View CaptureEtw.cs
void Main()
{
//include nuget package: http://www.nuget.org/packages/Microsoft.Diagnostics.Tracing.TraceEvent/
using (var session = new TraceEventSession("My session", null))
using (var source = new ETWTraceEventSource("My session", TraceEventSourceType.Session))
{
var parser = new DynamicTraceEventParser(source);
parser.All += delegate (TraceEvent data)
{
Console.WriteLine("Got Event: " + data.ToString());
@amithegde
amithegde / LpChart.linq
Created Jan 23, 2016
Quick and easy helper to render chars in LinqPad
View LpChart.linq
<Query Kind="Program">
<Reference>&lt;RuntimeDirectory&gt;\System.Windows.Forms.DataVisualization.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Windows.Forms.dll</Reference>
<Namespace>System.Windows.Forms.DataVisualization.Charting</Namespace>
<Namespace>System.Drawing</Namespace>
<Namespace>System.Windows.Forms</Namespace>
</Query>
void Main()
{
@amithegde
amithegde / tps.cs
Created Jan 14, 2016
calls a method n number of times a second
View tps.cs
void Main()
{
//calls a method n number of times in a second. tps = transactions per second
var tasker = new Tasker(tps: 10, taskToRun: (x) => {Console.WriteLine("hello " + x);});
tasker.Start(TimeSpan.FromSeconds(1));
}
public class Tasker
{
private int Tps { get; set; }
View DynamicTableEntityPrettyDump.cs
//driver.linq
void Main()
{
var account = "";
var key = "";
var tableName = "";
var cloudTable = GetStorageAccount(account, key).CreateCloudTableClient().GetTableReference(tableName);
var tableQuery = new TableQuery<DynamicTableEntity>().Where(filter: string.Empty);
View GroupByBasedOnTimeInterval.cs
void Main()
{
//my data entities
var dataList = new List<DataModel>();
for (int i = 0; i < 100; i++) {
dataList.Add(new DataModel {
SomeString = "some data",
SomeValue = i,
Timestamp = DateTimeOffset.UtcNow.AddMinutes(-(i+60))
});
View queryParser.htm
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<p>enter query in the format: colNam2: value. value can have double quotes for compound query</p>
<input type="text" id="queryText"/>
<div id="result"></div>
</body>
<script>
@amithegde
amithegde / jquery-ui-tooltip-with-user-interation.htm
Last active Aug 29, 2015
jQuery UI Tooltip which lets the user to interact with the tooltip such as copy text from the tooltip
View jquery-ui-tooltip-with-user-interation.htm
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Tooltip - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>