Skip to content

Instantly share code, notes, and snippets.

View cwharris's full-sized avatar
🖖

Christopher Harris cwharris

🖖
View GitHub Profile
@cwharris
cwharris / install-1password.sh
Last active July 21, 2023 14:22
Install 1Password
#!/bin/bash
# wget -O - <this gist> | bash
set -Eeox pipefail
# install 1password
sudo apt-get -y install curl
curl -sS https://downloads.1password.com/linux/keys/1password.asc | sudo gpg --dearmor --output /usr/share/keyrings/1password-archive-keyring.gpg
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/1password-archive-keyring.gpg] https://downloads.1password.com/linux/debian/amd64 stable main' | sudo tee /etc/apt/sources.list.d/1password.list
@cwharris
cwharris / BatchAsync.cs
Last active January 26, 2022 18:55
If you can understand this, you have a pretty good understanding of Rx, Async, Generics, and Extension Methods.
public static IObservable<TResult> BatchAsync<T, TResponse, TResult>(
this IObservable<T> source,
int count,
Func<IEnumerable<T>, CancellationToken, Task<TResponse>> process,
Func<TResponse, IEnumerable<TResult>> resultSelector
)
{
return source
.Buffer(count)
.SelectMany(batch =>
@cwharris
cwharris / Netgear-A7000.md
Created December 10, 2018 22:05
Useful Ubuntu Setup Stuff
https://askubuntu.com/questions/1025695/netgear-a7000-on-ubuntu-16-04-not-working
sudo apt-get update
sudo apt-get install git dkms
git clone https://github.com/zebulon2/rtl8814au.git
sudo dkms add ./rtl8814au 
sudo dkms build -m rtl8814au -v 4.3.21
sudo dkms install -m rtl8814au -v 4.3.21
@cwharris
cwharris / GroupByContinuity.cs
Last active July 18, 2018 22:05
Rx Grouping by continuity of a key
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
namespace ConsoleApplication1
{
internal class Program
{
public static void Main(string[] args)
@cwharris
cwharris / Program.cs
Last active July 13, 2018 22:01
Permutate
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Program
{
public static void Main()
{
var randomPassword =
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace Game.Curves
{
public static class BezierCurve
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 Evaluate(
@cwharris
cwharris / SinglePageMiddleware.cs
Last active February 2, 2017 04:56
AspNetCore SinglePageMiddleware.cs
using System;
using System.Threading.Tasks;
using System.Threading;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
namespace ChristopherHarris
@cwharris
cwharris / index.ts
Last active November 26, 2016 01:37
TypeScript Array<TItem> => { [key: TKey] }: TItem
import { toKeyedObjectWithNumber } from "./toKeyedObjectWithNumber";
var items = [
{ id: 1 },
{ id: 2 },
{ id: 3 }
];
var itemsById = toKeyedObject(items, item => item.id);

Keybase proof

I hereby claim:

  • I am cwharris on github.
  • I am cwharris (https://keybase.io/cwharris) on keybase.
  • I have a public key whose fingerprint is 1AF0 0C9A 28CB 9B59 F50A A3BB AD83 0673 F92A 4F0E

To claim this, I am signing this object:

@cwharris
cwharris / delayMinimumInterval.js
Created December 10, 2013 20:19
Rx.Observable.prototype.delayMinimumInterval: ensures a minimum interval between notifications.
Rx.Observable.prototype.delayMinimumInterval = function (relativeTime, scheduler) {
if (scheduler === undefined) scheduler = Rx.Scheduler.timeout;
var latest = scheduler.now();
return this
.selectMany(function (x) {
var now = new Date(scheduler.now());
var next = new Date(latest);
next.setMilliseconds(next.getMilliseconds() + relativeTime);