Skip to content

Instantly share code, notes, and snippets.

View NickLarsen's full-sized avatar
🏠
Working from home

Nicholas Larsen NickLarsen

🏠
Working from home
View GitHub Profile
@NickLarsen
NickLarsen / NinjectProfiledDbConnectionProvider
Created January 20, 2012 04:13
A connection provider to use with Ninject when using the MvcMiniProfiler
// Set your data context to no connection by default and then use this
// bind IDbConnection to this provider. It has to be a provider of
// IDbConnection or else it will try to use the string overload.
//
// Where you register your services, you'll add the following line in your scope of choice:
// kernel.Bind<IDbConnection>().ToProvider<ProfiledDbConnectionProvider>();
internal class ProfiledDbConnectionProvider : Provider<IDbConnection>
{
const string ConnectionStringName = @"connection string name";
@NickLarsen
NickLarsen / IdHelper.cs
Created February 3, 2012 21:17
Id helper for unit testing to ensure all objects have unique ids
public static class IdHelper
{
private static int CurrentId = 0;
public static int NextId()
{
var newId = Interlocked.Increment(ref CurrentId);
return newId;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Teleprompter</title>
<style type="text/css">
html, body {
height: 100%;
min-height: 100%;
}
#teleprompter {
async Task Main()
{
//Environment.Version.Dump();
Util.CreateSynchronizationContext();
// 3ms to 35ms
var times = Enumerable.Range(0, 1_000)
.Select(m =>
{
var randNorm = RandomNormal(10d, 10d);
return Math.Max(randNorm, 3d);
# inspiration from https://github.com/devicehive/devicehive-audio-analysis
import sys
import pyaudio
import numpy as np
import wave
import os
import tensorflow as tf
import vggish_input