Skip to content

Instantly share code, notes, and snippets.

View andredublin's full-sized avatar
🐝
buzz

Andre Dublin andredublin

🐝
buzz
View GitHub Profile
@andredublin
andredublin / aoc2022day1.clj
Last active December 3, 2022 03:14
aoc 2022
(defn parse-int [s] (Integer/parseInt s))
(defn chunk-lines-by-blank
"Given a seq of lines, assumes that chunks of lines are separated by a blank line
(a line containing only white space) and returns a seq of those chunks
(with each chunk being its own seq of lines)"
[lines]
(->> lines
(partition-by clojure.string/blank?)
(filter (fn [c]
@andredublin
andredublin / adventofcode.fs
Created December 1, 2020 18:56
Advent of code 2020
Day 1
let solve () =
let list = File.ReadLines("input.txt") |> Seq.map (fun str -> (int str)) |> Seq.toArray
let rec loop n rest=
let found = list |> Array.tryFind(fun value -> value + n = 2020)
if found.IsSome then printfn "%A" (found.Value * n)
else loop (Array.head rest) (Array.tail rest)
loop (Array.head list) (Array.tail list)

Keybase proof

I hereby claim:

  • I am andredublin on github.
  • I am andredublin (https://keybase.io/andredublin) on keybase.
  • I have a public key ASCmneb3G-wIRxvTJH_HrAePCcaMOjhaWHvjbWEcCdBWNAo

To claim this, I am signing this object:

Paket version 5.194.0
Starting full restore process.
Performance:
- Disk IO: 1 minute, 1 second
- Runtime: 1 minute, 7 seconds
This runner is now obsolete with FAKE 5, please upgrade to the new .Net Core runner. See https://fake.build/fake-migrate-to-fake-5.html
To remove this warning you can append the '--removeLegacyFakeWarning' argument or set the 'FAKE_NO_LEGACY_WARNING' environment variable to 'true'
Building project with version: LocalBuild
Shortened DependencyGraph for Target Build:
<== Build
@andredublin
andredublin / MyToken.sol
Created May 10, 2018 00:32
MyToken.sol with multlple agents
pragma solidity ^0.4.23;
import "./Ownable.sol";
contract MyToken is Ownable {
mapping (address => bool) public agents;
modifier onlyAgent {
require(agents[msg.sender]);
_;
@andredublin
andredublin / Agent.sol
Last active May 10, 2018 00:28
solidity agent pattern
pragma solidity ^0.4.23;
import "./MyToken.sol";
contract Agent {
MyToken token;
constructor(MyToken _token) public {
token = _token
}
pragma solidity ^0.4.23;
import "./Ownable.sol";
contract MyToken is Ownable {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor(uint256 initialSupply) public {
@andredublin
andredublin / genesis_public_key
Created February 21, 2018 15:03
genesis_public_key
0421c428d473707698cd53e2300b0b6b49a375dd0e440a77056ef9b43263e66239e7afceec154885ad30caaafd977cf4649cc1e07f5d809bcacb5a81b41773d17a
module FableD3
open Fable.Core
open Fable.Core.JsInterop
open Fable.Import
open Fable.Import.Browser
let chart() =
let data = [| 30; 86; 168; 201; 303; 365 |]
D3.Globals.select("chart")
@andredublin
andredublin / fableconfig.json
Created November 28, 2016 02:28
fable config using rollup
{
"targets": {
"develop": {
"sourceMaps": true,
"projFile": "./src/app/app.fsproj",
"outDir": "temp",
"verbose": true,
"watch": true,
"rollup": {
"entry": "./public/bundle.js",