Instantly share code, notes, and snippets.

View fibb.cs
using System.Collections.Generic;
namespace FibonacciTest
{
public static class FibonacciGenerator
{
public static IEnumerable<int> Fibonacci()
{
int current = 1, next = 1;
while (true)
View removeNetCorePreviews.ps1
$choices = New-Object Collections.ObjectModel.Collection[Management.Automation.Host.ChoiceDescription]
$choices.Add((New-Object Management.Automation.Host.ChoiceDescription -ArgumentList '&Yes'))
$choices.Add((New-Object Management.Automation.Host.ChoiceDescription -ArgumentList '&No'))
Get-WmiObject Win32_Product -filter "name LIKE '%Preview%' AND name LIKE '%SDK%'" | ForEach-Object {
$message = "ZOMG"
$question = "Uninstall " + $_.Name + "?"
$decision = $Host.UI.PromptForChoice($message, $question, $choices, 0)
if($decision -eq 0) {
$_.Uninstall()
View aspnetcore.yml
---
apiVersion: v1
kind: Service
metadata:
name: aspnetcoreapp
labels:
app: aspnetcoreapp
spec:
type: NodePort
ports:
View Dockerfile
FROM microsoft/dotnet:2.0-sdk as builder
RUN mkdir -p /root/src/app/aspnetcoreapp
WORKDIR /root/src/app/aspnetcoreapp
#copy just the project file over
# this prevents additional extraneous restores
# and allows us to resuse the intermediate layer
# This only happens again if we change the csproj.
# This means WAY faster builds!
View k8s-pi.md

K8s on (vanilla) Raspbian Lite

Yes - you can create a Kubernetes cluster with Raspberry Pis with the default operating system Raspbian. Carry on using all the tools and packages you're used to with the officially-supported OS.

Pre-reqs:

  • You must use an RPi2 or 3 for Kubernetes
  • I'm assuming you're using wired ethernet (Wi-Fi also works)

Master node setup

View dumpme
app.get('/dumpme', function (req, res) {
var fs = require('fs'),
ws = fs.createWriteStream('debugdump/'+Date.now() + '.heapsnapshot'),
profiler = require('v8-profiler'),
snapshot = profiler.takeSnapshot(),
callback = ws.end.bind(ws);
snapshot.serialize(function(data) {
ws.write('' + data);
}, callback);//begin cpu profiling
View IIS and Windows 10 14942
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\W3SVC /v SvcHostSplitDisable /t REG_DWORD /d 1 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\WAS /v SvcHostSplitDisable /t REG_DWORD /d 1 /f
View blogpost
<p>It's always the little throwaway tweets that go picked up. Not the ones that we agonize over. I was doing some work at the command line and typed "dotnet --version | clip" to copy the .NET Core version number into the clipboard. Then I tweeted a little "hey, remember this great utility?" and then the plane took off. I landed two hours later and it had over 500 RTs. Madness. </p> <p>It's funny that 10 year old command prompt utility (this was added in Vista) that everyone's forgotten elicits such an enthusiastic response.</p> <p>Since you all love that stuff, here's a few other "forgotten command prompt features."</p> <center> <blockquote class="twitter-tweet" data-lang="en"> <p lang="en" dir="ltr">Windows folk: Did you know you can pipe cmd prompt commands into the clipboard? <a href="https://t.co/fSE7ZHBBbB">pic.twitter.com/fSE7ZHBBbB</a></p>— Scott Hanselman (@shanselman) <a href="https://twitter.com/shanselman/status/744967489356865538">June 20, 2016</a></blockquote><script async src="//platform.twitte
View dasblog.txt
<figure><a href="https://flic.kr/p/9arwvh"><img title="Burnout photo by Michael Himbeault used under cc" style="display: inline" alt="Burnout photo by Michael Himbeault used under cc" src="http://www.hanselman.com/blog/content/binary/Windows-Live-Writer/Burnout-Or-just-a-natural_CE1C/5357683026_a34d4df4ba_b_0d1090af-d456-4276-8f7d-19186a95d315.jpg" width="999" height="330"></a></figure> <p><a href="https://twitter.com/sarahmei">Sarah Mei</a> had a great series of tweets last week. She's a Founder of RailsBridge, Director of Ruby Central, and the Chief Consultant of <a href="https://www.devmynd.com/">DevMynd</a> so she's experienced with work both "on the job" and "on the side." Like me, she organizes OSS projects, conferences, but she also has a life, as do I.</p> <p>If you're reading this blog, it's likely that you have gone to a User Group or Conference, or in some way did some "on the side" tech activity. It could be that you have a blog, or you tweet, or you do videos, or you volunteer at a school.</p>
View Program.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace WebApplication
{
public class Program{