Skip to content

Instantly share code, notes, and snippets.

View adamnemecek's full-sized avatar

adamnemecek

View GitHub Profile
enum Sharp: Int { case C = 0, G, D, A, E, B, F }
func sKeyForNote(n: Sharp) -> [Sharp] {
return (0..<n.rawValue)
.map{ n in (n + 6) % 7 }
.flatMap(Sharp.init)
}
enum Flat: Int { case F = 1, B, E, A, D, G }
@adamnemecek
adamnemecek / ml_resources.md
Created January 3, 2017 18:52 — forked from vaibhaw/ml_resources.md
Machine Learning Resources

Courses

Keybase proof

I hereby claim:

  • I am adamnemecek on github.
  • I am adamnemecek (https://keybase.io/adamnemecek) on keybase.
  • I have a public key ASAYuMz0BsFIrC7WD0_ZdesQuR0yrAOmRH6ZJlp_7CF-1wo

To claim this, I am signing this object:

@adamnemecek
adamnemecek / BikeNode.swift
Created April 4, 2018 18:07 — forked from lachlanhurst/BikeNode.swift
Poorly written extract of source code used to create SceneKit 'bike dude'. Video here https://www.youtube.com/watch?v=UYwLltzNu_w
//
// MIT License
// Copyright (c) 2017 Lachlan Hurst
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@adamnemecek
adamnemecek / Clifford.hs
Created March 29, 2019 16:55 — forked from fkuehnel/Clifford.hs
Haskell module for Clifford Algebra tensor representations, and a Geometric Algebra module utilizing the tensor representation
-- credit goes to sigfpe
{-# LANGUAGE MultiParamTypeClasses
,TemplateHaskell
,GeneralizedNewtypeDeriving
,DeriveFunctor
,FunctionalDependencies
,FlexibleInstances
,UndecidableInstances
,FlexibleContexts
,Rank2Types #-}
@adamnemecek
adamnemecek / gist:ae2755c5c4eaabd0d864e6c62dbe5088
Created November 28, 2019 21:10 — forked from LearnCocos2D/gist:77f0ced228292676689f
Overview of Entity Component System (ECS) variations with pseudo-code

For background and further references see: Entity Component Systems on Wikipedia

ECS by Scott Bilas (GDC 2002)

Entity->Components->Update
  • entity = class: no logic + no data OR at most small set of frequently used data (ie position)
  • component = class: logic + data
foreach entity in allEntities do
    foreach component in entity.components do

Adjointness

Adjoint

Adjointness expresses a condition that is essentially universal in mathematics, category theory, probability, logic, optimization, machine learning.

What is adjointness? Depends on the context.

This page is really illuminating.

@adamnemecek
adamnemecek / launch.json
Last active March 17, 2023 13:15
VSCode Rust debugging on macOS config
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "${workspaceRoot}/target/debug/${workspaceRootFolderName}",
"args": [],
"cwd": "${workspaceRoot}",
@adamnemecek
adamnemecek / programming-as-theory-building.md
Created June 1, 2020 03:25 — forked from onlurking/programming-as-theory-building.md
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct

struct User : Equatable {
let id: UInt
let selected: Bool
}
var z = (0...10).map { User(id: $0, selected: $0 == 3 || $0 == 6 || $0 == 10) }
var q = (0...10).map { User(id: $0, selected: $0 == 3 || $0 == 6 || $0 == 10) }
z.gather(at: 0) { $0.selected }
z.gather(at: 5) { $0.selected }