Skip to content

Instantly share code, notes, and snippets.

Avatar

Namit Tanasseri namitts82

View GitHub Profile
View MeasureAudio.cs
private float AnalyzeSound()
{
float[] samples = new float[1024];
this.audioSource.GetOutputData(samples, 0); // fill array with samples
float sum = 0;
for (int i = 0; i < 1024; i++)
{
sum += samples[i] * samples[i]; // sum squared samples
}
return Mathf.Sqrt(sum / 1024); // rms = square root of average
View Function.cs
namespace VSOBugReporter
{
public class Functions
{
/// <summary>
/// Sends an email using sendgrid
/// </summary>
/// <param name="message">message body</param>
private void SendMail(string message)
@namitts82
namitts82 / Program.cs
Last active Apr 20, 2016
WebHooks Main
View Program.cs
namespace VSOBugReporter
{
class Program
{
static void Main()
{
var config = new JobHostConfiguration();
// Enabling detailed tracing
config.Tracing.ConsoleLevel = TraceLevel.Verbose;
View WebJobEndLog.json
{
"Type": "FunctionCompleted", <- Web Job Status
"EndTime": "2016-02-18T05:22:24.8783464+00:00", <- Time when web job ended
"ParameterLogs": {},
"FunctionInstanceId": " d463f402-04bd-48d4-bcad-ce7bafcb858a", <- The instance ID of the function being bound to. This unique is of GUID datatype
"Function": {
"Id": "testjob.Functions.ProcessSomething", <- Name of the function executed by the WebJob. Format - namespace.class.functionname
"FullName": "testjob.Functions.ProcessSomething",
"ShortName": "Functions.ProcessSomething",
"Parameters": [
View WebJobstartlog.json
{
"Type": "HostStarted", <- Status of the Web Job execution
"Functions": [
{
"Id": "testjob.Functions.ProcessSomething", <- Name of the function executed by the WebJob. Format - namespace.class.functionname
"FullName": "testjob.Functions.ProcessSomething",
"ShortName": "Functions.ProcessSomething",
"Parameters": [
{
"Type": "ParameterDescriptor",
View ProcessSomething.cs
namespace testjob
{
public class Functions
{
[NoAutomaticTriggerAttribute]
public static async Task ProcessSomething(TextWriter log)
{
Thread.Sleep(7000);
log.WriteLine("Process Something called at : " + DateTime.Now.ToShortDateString() + " , " + DateTime.Now.ToShortTimeString());