Skip to content

Instantly share code, notes, and snippets.

@ingted
ingted / gist:a12d984d9d3013b7909403bfd9c1f472
Created January 8, 2024 05:19 — forked from mathias-brandewinder/gist:6443302
Experimenting with Accord SVM
#r @"..\packages\Accord.2.8.1.0\lib\Accord.dll"
#r @"..\packages\Accord.Math.2.8.1.0\lib\Accord.Math.dll"
#r @"..\packages\Accord.Statistics.2.8.1.0\lib\Accord.Statistics.dll"
#r @"..\packages\Accord.MachineLearning.2.8.1.0\lib\Accord.MachineLearning.dll"
open System
open System.IO
open Accord.MachineLearning
open Accord.MachineLearning.VectorMachines
@ingted
ingted / RSAKeys.cs
Created February 27, 2023 10:33 — forked from therightstuff/RSAKeys.cs
Import and export RSA Keys between C# and PEM format using BouncyCastle
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Security.Cryptography;
namespace MyProject.Data.Encryption
{
@ingted
ingted / create-aspnet-core-identity-schema.sql
Created January 6, 2023 03:05 — forked from akatakritos/create-aspnet-core-identity-schema.sql
Script to create the ASPNET core Identity tables
USE [HobbyDB]
GO
/****** Object: Table [dbo].[AspNetRoleClaims] Script Date: 6/4/2018 10:18:03 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AspNetRoleClaims]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[AspNetRoleClaims](
namespace ChironB.Benchmarks
open Chiron
open BenchmarkDotNet.Attributes
open Newtonsoft.Json
open Newtonsoft.Json.Linq
module Bench =
open System.IO
open System.Text
@ingted
ingted / iron_magic.py
Created March 7, 2022 05:57 — forked from maxhk/iron_magic.py
IronPython magic for iPython notebook
from __future__ import print_function
from IPython.core.magic import register_cell_magic
import subprocess as sp
import tempfile
import os
IRON_PYTHON_PATH = r'C:\HOMEWARE\IronPython-2.7.5\ipy64.exe'
@register_cell_magic
def iron(line, cell):
@ingted
ingted / listAllEventListeners.js
Created May 22, 2021 01:57 — forked from tkafka/listAllEventListeners.js
List all event listeners in a document
console.table((function listAllEventListeners() {
const allElements = Array.prototype.slice.call(document.querySelectorAll('*'));
allElements.push(document); // we also want document events
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
let elements = [];
for (let i = 0; i < allElements.length; i++) {
@ingted
ingted / listAllEventListeners.js
Created May 22, 2021 01:57 — forked from dmnsgn/listAllEventListeners.js
List all event listeners in a document
const listeners = (function listAllEventListeners() {
let elements = [];
const allElements = document.querySelectorAll('*');
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
for (let i = 0; i < allElements.length; i++) {
const currentElement = allElements[i];
@ingted
ingted / gist:5ad016bcf273fc8aebd6fd722c456bac
Created February 21, 2021 10:32 — forked from mathias-brandewinder/gist:d3daebd687f2095de1b1
Conversion to F# of "Gradient Descent Training Using C#"
// This is a conversion to F# of the C# code presented in
// MSDN Magazine, March 2015, by James McCaffrey:
// https://msdn.microsoft.com/en-us/magazine/dn913188.aspx
open System
let sumprod (v1:float[]) (v2:float[]) =
Seq.zip v1 v2 |> Seq.sumBy (fun (x,y) -> x * y)
let sigmoid z = 1.0 / (1.0 + exp (- z))
// wrapper function over TestKit.ActorOfAsTestActorRef
let spawnAsTestRef (tck:Tck) (props: Props<'T>) : IActorRef<'T> =
typed (tck.ActorOfAsTestActorRef<FunActor<'T>>(props.ToProps(), tck.TestActor) :> IActorRef)
[<Fact>]
let ``Parent should create child`` () = testDefault <| fun tck ->
// child actor definition
let child (ctx: Actor<_>) msg = ctx.Sender() <! "hello" |> ignored
// parent actor defintion
let rec parent (ctx: Actor<_>) =
@ingted
ingted / gist:c20752361ede0967d8d4e2739cf4cf94
Created September 17, 2020 15:59 — forked from rstackhouse/gist:1162357
Configure NLog Programmatically
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NLog.Common;
using NLog.Targets;
using NLog.Config;
namespace ConsoleApplication1