Skip to content

Instantly share code, notes, and snippets.

View danielbh's full-sized avatar

Daniel Hollcraft danielbh

View GitHub Profile
@danielbh
danielbh / NSubexample.cs
Last active August 29, 2015 14:27
Keeping default implementation for virtual methods
[Test]
public void ShouldCallBaseImplementationForVirtualMember()
{
var testClass = Substitute.ForPartsOf<TestClass>();
testClass.VoidVirtualMethod();
testClass.VoidVirtualMethod();
testClass.VoidVirtualMethod();
Assert.That(testClass.CalledTimes, Is.EqualTo(3));
}
FROM resin/raspberrypi3-debian:jessie
ENV INITSYSTEM on
# Add the key for foundation repository
RUN apt-get update
RUN apt-get install wget
RUN wget http://archive.raspberrypi.org/debian/raspberrypi.gpg.key -O - | sudo apt-key add -
FROM resin/raspberrypi3-debian:jessie
ENV INITSYSTEM on
# Add the key for foundation repository
RUN apt-get update
RUN apt-get install -y wget
RUN wget http://archive.raspberrypi.org/debian/raspberrypi.gpg.key -O - | sudo apt-key add -
# Add apt source of the foundation repository
var Promise, app, async, bodyParser, closeHotspot, config, connectOrStartServer, connectionFile, connectionsFromFile, connman, dnsServer, execAsync, express, fs, getIptablesRules, hostapd, ignore, iptables, manageConnection, openHotspot, os, passphrase, port, retryAsync, saveToFile, server, setupHostapd, setupUdhcpd, spawn, ssid, ssidList, startServer, systemd, udhcpd;
Promise = require('bluebird');
connman = Promise.promisifyAll(require('connman-simplified-resin')());
express = require('express');
app = express();
#!/bin/bash
DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host_run/dbus/system_bus_socket npm start
while true
do
echo "App exited but container is still running to allow web terminal access"
sleep 3600
done
#!/bin/bash
yum update -y
yum install httpd24 -y
service httpd start
chkconfig httpd on
echo "<html><body><h1>Hello Cloud Gurus, this is X</h1></body></html>" > /var/www/html/index.html
@danielbh
danielbh / loading.js
Created July 30, 2017 12:37
containers/Panel/loading.js
import React from 'react';
import './index.css';
import ReactLoading from 'react-loading'
const PanelLoading = () => (
<div className="panel">
<ReactLoading className="loading-widget" type="bars" color="white" delay={0}/>
</div>
);
{
“window.zoomLevel”: 2,
“files.autoSave”: “onFocusChange”,
“editor.formatOnPaste”: true,
“editor.formatOnType”: true,
“editor.detectIndentation”: false,
“editor.minimap.enabled”: false,
“editor.fontLigatures”: true,
“editor.renderIndentGuides”: true,
“editor.renderWhitespace”: “boundary”,
@danielbh
danielbh / WhyILikeGo.md
Created October 12, 2018 13:36 — forked from freeformz/WhyILikeGo.md
Why I Like Go

A slightly updated version of this doc is here on my website.

Why I Like Go

I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.

Goroutines

The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x), where f() is a function.

@danielbh
danielbh / wrapper.go
Created January 30, 2019 00:59 — forked from KarthikNayak/wrapper.go
Go Meetup NYC; 29th Jan
package main
import (
"io"
"os"
"fmt"
"time"
)
type SlowWriter struct {