Skip to content

Instantly share code, notes, and snippets.

View evakili's full-sized avatar

Esmaeil Vakili evakili

View GitHub Profile
@evakili
evakili / tdd_hello_world.cpp
Created February 24, 2019 06:59
TDD Hello World!
#include <cassert>
int main() {
assert(true);
}
@evakili
evakili / tfs_cycle_time.sql
Created April 29, 2018 12:56
This is a simple query to calculate average cycle time per team project from Team Foundation Server data warehouse.
Declare @from date;
Declare @initial_state nvarchar(256);
Declare @final_state nvarchar(256);
Set @from = DATEADD(year,-1,GETDATE());
Set @initial_state = 'Committed';
Set @final_state = 'Done';
With wi As (
Select TeamProjectSK, System_Id, System_State, System_ChangedDate, System_WorkItemType
@evakili
evakili / ByteStreamToHexString.cpp
Created December 18, 2017 12:03
Converting a stream of bytes to a string of hex with C++
#include <iostream>
#include <sstream>
#include <iomanip>
#include <iterator>
template<typename T, int Width>
struct fixed_width_t
{
fixed_width_t(T val) : val{ val } {}
T val;
@evakili
evakili / malloc_unique_ptr.h
Last active March 15, 2024 02:13
A generic unique_ptr with malloc/free
#ifndef MALLOC_UNIQUE_PTR_H
#define MALLOC_UNIQUE_PTR_H
/*
idea borrowed from http://www.codeproject.com/Articles/820931/Using-std-unique-ptr-RAII-with-malloc-and-free
*/
#include<memory>
template<typename T>