Skip to content

Instantly share code, notes, and snippets.

View amithegde's full-sized avatar
🎯
Focusing

Amit Hegde amithegde

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

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 January 28, 2016 22:47
capturing EWT events
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 January 23, 2016 22:25
Quick and easy helper to render chars in LinqPad
<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 January 14, 2016 22:16
calls a method n number of times a second
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; }
//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);
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))
});
<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 August 29, 2015 13:57
jQuery UI Tooltip which lets the user to interact with the tooltip such as copy text from the tooltip
<!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>