Skip to content

Instantly share code, notes, and snippets.

ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width)) +
geom_point(aes(color=Species, shape=Species)) +
xlab("Sepal Length (cm)") + ylab("Sepal Width (cm)") +
ggtitle("Sepal Length vs Width", subtitle="A plot for class") +
geom_vline(linetype= "dashed", aes(xintercept=mean(Sepal.Length), color="red"))
@BenjaminHolland
BenjaminHolland / OverlappedIOToTask.cs
Created January 5, 2019 02:38
Example of converting an overlapped IO call into a task. Extremely Incomplete. .NET Core 2.1
using System;
using System.Buffers;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using PInvoke;
namespace PInvoke
let input: [boolean] = [
true, true, true,
false, false,
true, true,
false,
true,
false,
true,
false, false]
public static class NumericConverter
{
public enum PadMode
{
Zeros,
Ones,
Sign
}
private const int positiveExt = 0x00;
private const int negativeExt = 0xFF;
@BenjaminHolland
BenjaminHolland / gist:c4e209b6b5fc5db925cbd8e79b7d5e7e
Created December 1, 2017 18:53
Strange Overload Resolution Issue.
#include <functional>
#include <iostream>
#include <string>
#include <mutex>
#include <thread>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
using namespace std;
public static Task WaitOneAsync(this WaitHandle waitHandle)
{
if (waitHandle == null)
throw new ArgumentNullException("waitHandle");
var tcs = new TaskCompletionSource<bool>();
var t = tcs.Task;
RegisteredWaitHandle rwh = null;
t=t.ContinueWith((antecedent) => rwh.Unregister(null));
rwh = ThreadPool.RegisterWaitForSingleObject(waitHandle,
@BenjaminHolland
BenjaminHolland / RxStreamAdapter.cs
Created July 15, 2017 17:30
Reactive Observable Asynchronous Stream Adapter
using RJCP.IO.Ports;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Text;
using System.Threading;
@BenjaminHolland
BenjaminHolland / .gitattributes
Created April 26, 2017 01:26
Git Attributes File
* text=lf
*.js text
*.sh text
*.py text
*.md text
*.css text
*.html text
*.txt text
public Boolean TryOpen(){
.
.
.
_hDrive = FileIO.Methods.CreateFile(
Info.PhysicalPath,
FileIO.FileAccess.GenericRead | FileIO.FileAccess.GenericWrite,
FileIO.FileShare.Read | FileIO.FileShare.Write,
IntPtr.Zero,
void setup()
{
size(400,400);
background(255);
}
void drawBlob(int x,int y)
{
noStroke();
float val=0f;
for(int i=0;i<10;i++)