Skip to content

Instantly share code, notes, and snippets.

using System;
// ReSharper disable JoinDeclarationAndInitializer
// ReSharper disable InconsistentNaming
namespace SudokuProcedural
{
static class Program
{
static void Main()
@daxfohl
daxfohl / processor.v
Last active December 17, 2015 07:48
Verilog sample for reversing an array
module processor(clk, rxReady, rxData, txBusy, txStart, txData);
input clk;
input[7:0] rxData;
input rxReady;
input txBusy;
output reg txStart;
output reg[7:0] txData;
localparam READ=0, SOLVING=1, WRITE1=2, WRITE2=3;
localparam LEN = 10;
@daxfohl
daxfohl / gist:6143558
Last active December 20, 2015 13:59
Speed test
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace ConsoleApplication195
{
static class Program
{
static void Main()
@daxfohl
daxfohl / gist:328641f74b00aa7124c5
Created November 4, 2014 13:54
regex for f# too many params
let \w+ (\w+ |\(.*\) ){4,}=
open System.Diagnostics
let N = 100000
let calc_sync i = i % 10
let sum_sync() =
async {
let ints = Seq.initInfinite calc_sync |> Seq.take N
return Seq.sum ints
}
@daxfohl
daxfohl / clj_async.clj
Last active November 21, 2023 19:08
clj_async
(use '[clojure.algo.monads])
(require '[clojure.core.async :as async])
(defmonad async-m
"Monad describing async operations."
[m-result (fn m-result-async [v]
(let [c (async/chan)]
(async/go (async/>! c v))
c))
@daxfohl
daxfohl / skynet.fsx
Last active February 14, 2016 17:04
261 ms F# MailboxProcessor impl of https://github.com/atemerev/skynet
#time "on"
type State = { remaining: int64; aggregate: int64 }
let div = 10L
let rec skynet num size postback =
if size = 1L then
postback num
else
@daxfohl
daxfohl / skynet.fsx
Created February 14, 2016 17:08
261 ms F# MailboxProcessor impl of https://github.com/atemerev/skynet
#time "on"
type State = { remaining: int64; aggregate: int64 }
let div = 10L
let rec skynet num size postback =
if size = 1L then
postback num
else
<?xml version="1.0" encoding="UTF-8"?>
<Response><Sms>Nothing to see here.</Sms></Response>
{{input}} -annotate +10+20 "{{firstName}} {{lastName}}" {{output}}