This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ATX Power Controller | |
* ATX Breakout Board is Amazon ASIN B01MY7KK80 | |
Basically: | |
* Connect PS_ON and GND from the PSU to a Relay's NO connectors. Leave the NC connector just floating. | |
* Connect the Trigger Pin of the Relay to Pin 9 (RELAY_PIN) of the Arduino | |
* Connect the Power Button of the case to Pin 12 (PWRBTN_PIN) of the Arduino, and GND | |
* Connect the Power LED of the case to Pin 10 (PSUPOWER_LED) of the Arduino, and GND, using an appropriate resistor (e.g., 330 Ohm) | |
* Connect a Piezo Speaker to Pin 11 (SPKR_PIN) of the Arduino, and GND |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var f = new AtomicFlag(true); | |
Console.WriteLine($"Value: {f.Value}"); | |
var oldVal = f.CompareExchange(true, false); | |
Console.WriteLine($"Old Val: {oldVal}, Value: {f.Value}"); | |
oldVal = f.CompareExchange(true, false); | |
Console.WriteLine($"Old Val: {oldVal}, Value: {f.Value}"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: tomcat | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start and stop Apache Tomcat | |
# Description: Enable Apache Tomcat service provided by daemon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarkDotNet=v0.10.13, OS=Windows 10 Redstone 3 [1709, Fall Creators Update] (10.0.16299.309) | |
Intel Core i7-6700HQ CPU 2.60GHz (Skylake), 1 CPU, 8 logical cores and 4 physical cores | |
Frequency=2531253 Hz, Resolution=395.0613 ns, Timer=TSC | |
[Host] : .NET Framework 4.7 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.2633.0 | |
Clr : .NET Framework 4.7 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.2633.0 | |
Job=Clr Runtime=Clr | |
Method | Mean | Error | StdDev | Allocated | | |
---------------------------- |---------:|---------:|---------:|----------:| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from https://www.bouncycastle.org/ | |
// Adapted to create and return a string rather than write to a Stream | |
// https://twitter.com/mstum/status/970207754207006720 | |
private static readonly byte[] encodingTable = | |
{ | |
(byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', | |
(byte)'8', (byte)'9', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
/// <summary> | |
/// Wrapper for Two Dictionaries to allow lookup by Key or by Value. | |
/// Note that Value can't ever be null, as Dictionary will throw on a null Key. | |
/// </summary> | |
/// <typeparam name="TKey"></typeparam> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.AspNetCore.Mvc.Filters; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Stuff.Web | |
{ | |
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | |
public class LimitContentTypesFilterAttribute : Attribute, IResourceFilter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class TreeDrawer | |
{ | |
/// <summary> | |
/// Output a Tree to the console | |
/// </summary> | |
/// <remarks> | |
/// Example Output: | |
/// | |
/// NodeName | |
/// ├─ NodeName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server: | |
* Enable-PSRemoting (use sconfig for that) | |
* Enable-WSManCredSSP -Role Server | |
Client: | |
* Run PowerShell as Admin | |
* Enable-PSRemoting | |
* Set-Item WSMan:\localhost\Client\TrustedHosts -Value "fqdn-of-hyper-v-host" | |
* -Concatenate can be used to add | |
* https://stackoverflow.com/questions/21548566/how-to-add-more-than-one-machine-to-the-trusted-hosts-list-using-winrm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#@ template debug="false" hostspecific="false" language="C#" #> | |
<#@ assembly name="System.Core" #> | |
<#@ import namespace="System.Linq" #> | |
<#@ import namespace="System.Text" #> | |
<#@ import namespace="System.Collections.Generic" #> | |
<#@ output extension=".cs" #> | |
<# | |
var nsName = "Testing"; | |
var className = "MyTestClass"; | |
var accessor = "public"; |
NewerOlder