Skip to content

Instantly share code, notes, and snippets.

View dterracino's full-sized avatar
🐢
I may be slow to respond…

David Terracino dterracino

🐢
I may be slow to respond…
View GitHub Profile
@dterracino
dterracino / CounterSignal.cs
Created July 28, 2017 02:25 — forked from hanswolff/CounterSignal.cs
Counter that can be waited on for reaching a certain value
//
// Copyright 2013-2014 Hans Wolff
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
@dterracino
dterracino / Curve25519.cs
Created July 28, 2017 02:26 — forked from hanswolff/Curve25519.cs
C# implementation of Curve25519
/* Ported parts from Java to C# and refactored by Hans Wolff, 17/09/2013
Original: https://github.com/hanswolff/curve25519
*/
/* Ported from C to Java by Dmitry Skiba [sahn0], 23/02/08.
* Original: http://code.google.com/p/curve25519-java/
*/
/* Generic 64-bit integer implementation of Curve25519 ECDH
* Written by Matthijs van Duin, 200608242056
@dterracino
dterracino / iter.cs
Created July 28, 2017 05:19 — forked from joelmartinez/iter.cs
A simple extension method that gives you the "Iter" function from F#
static class x10 {
public static IEnumerable<T> Iter<T>(this IEnumerable<T> list, Action<T> action) {
foreach (var n in list) {
action (n);
yield return n;
}
}
}
@dterracino
dterracino / program.cs
Created July 28, 2017 05:25 — forked from joelmartinez/program.cs
simple proof of concept to generate permutations from two lists ... First, there needed to be every permutation for the platforms list. Second was a permutation of the platform and tags lists.
using System;
using System.Linq;
using System.Collections.Generic;
namespace Permutations
{
class MainClass
{
public static void Main (string[] args)
{
@dterracino
dterracino / Rfc822DateTimeParser.cs
Created August 3, 2017 22:05 — forked from tomtung/Rfc822DateTimeParser.cs
Rfc822DateTimeParser - Parse Date-Time In RFC-822 Format
//* ------------------------------------------------------------------------
//* Rfc822DateTimeParser - Parse Date-Time In RFC-822 Format
//* Copyright (C) 2009 Tom Dong
//*
//* This library is free software; you can redistribute it and/or
//* modify it under the terms of the GNU Lesser General Public
//* License as published by the Free Software Foundation; either
//* version 2.1 of the License, or (at your option) any later version.
//* ------------------------------------------------------------------------
@dterracino
dterracino / gist:1fdb5a08975389769dbdaaa4d90b3ee1
Created August 17, 2017 11:43 — forked from cori/gist:672685
C# String extension method implementing VB's Like() method (shamelessly cribbed from http://www.vbusers.com/codecsharp/codeget.asp?ThreadID=25)
using System;
using System.Text.RegularExpressions;
namespace ETC.Helpers
{
public static class StringExtensions
{
/// <summary>
/// Indicates whether the regular expression specified in "pattern" could be found in the "text".
@dterracino
dterracino / rs_exclude.txt
Created January 5, 2019 15:49 — forked from treehousetim/rs_exclude.txt
rsync example
._*
.DS_Store
.svn
/publish
@dterracino
dterracino / Game-parse.js
Created January 20, 2019 13:42 — forked from CodeOfficer/Game-parse.js
Parse PS4 game data
// vist https://store.playstation.com/en-us/home/games
// look at localstorage
// copy your entitlements data and substitue for GAME_DATA below
const games = GAME_DATA;
const sortedGames = games.sort(function(a, b) {
var textA = a.game_meta.name.toUpperCase();
var textB = b.game_meta.name.toUpperCase();
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
@dterracino
dterracino / HttpFileServer.cs
Created March 8, 2019 22:16 — forked from flq/HttpFileServer.cs
Smallest file web server
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
public class HttpFileServer : IDisposable
{
private readonly string rootPath;
private const int bufferSize = 1024*512; //512KB
@dterracino
dterracino / UiMessages.cs
Created March 8, 2019 22:35 — forked from flq/UiMessages.cs
Example setup for Membus to dispatch messages of a certain kind onto the UI thread...
// Use like BusSetup.StartWith<Conservative>().Apply<UiMessages>().Construct();
internal class UiMessages : ISetup<IConfigurableBus>
{
void ISetup<IConfigurableBus>.Accept(IConfigurableBus setup)
{
setup.ConfigurePublishing(obj =>
{
obj.MessageMatch(mi => mi.IsType<IUIMsg>()).PublishPipeline(new UiMsgDispatcher());
});