Skip to content

Instantly share code, notes, and snippets.

View willowell's full-sized avatar
🤖
Pressing the "do my job" key

William Howell willowell

🤖
Pressing the "do my job" key
View GitHub Profile
@ttesmer
ttesmer / AD.hs
Last active October 29, 2024 15:35
Automatic Differentiation in 38 lines of Haskell using Operator Overloading and Dual Numbers. Inspired by conal.net/papers/beautiful-differentiation
{-# LANGUAGE TypeSynonymInstances #-}
data Dual d = D Float d deriving Show
type Float' = Float
diff :: (Dual Float' -> Dual Float') -> Float -> Float'
diff f x = y'
where D y y' = f (D x 1)
class VectorSpace v where
zero :: v
@nicuveo
nicuveo / Main.hs
Last active November 3, 2022 09:23
Minimalistic JSON parser, using a Parsec-like approach
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE LambdaCase #-}
import Control.Applicative (liftA2)
import Data.Char
import Data.Foldable (for_)
import Data.Functor
import qualified Data.HashMap.Strict as M
import Data.List (intercalate)
import Prelude hiding (any)
@Nikolaj-K
Nikolaj-K / category_theory_literature.md
Last active September 16, 2024 10:26
Recomended reading for the undergrad category theorist
@mpilquist
mpilquist / philosophers.scala
Last active April 28, 2023 23:31
Dining Philosophers with FS2
/*
scalaVersion := "2.12.7"
resolvers += Resolver.sonatypeRepo("snapshots")
libraryDependencies += "co.fs2" %% "fs2-core" % "1.0.1-SNAPSHOT"
*/
import cats._
import cats.implicits._
import cats.effect._
@johnazariah
johnazariah / LinqExtensions.cs
Last active November 15, 2024 13:04
Maybe Monad in C#
public static partial class LinqExtensions
{
public static Maybe<C> SelectMany<A, B, C>(this Maybe<A> ma, Func<A, Maybe<B>> f, Func<A, B, C> select) => ma.Bind(a => f(a).Map(b => select(a, b)));
}
@CMCDragonkai
CMCDragonkai / NestedList.hs
Last active February 20, 2022 00:05
Megaparsec Parsing of a Nested Indented List #haskell
{-# LANGUAGE QuasiQuotes #-}
module NestedList where
import Control.Applicative (empty)
import Control.Monad (void)
import Data.Char (isAlphaNum)
import Data.Text (unpack)
import Data.Void (Void)
import NeatInterpolation (text)
@480
480 / gist:3b41f449686a089f34edb45d00672f28
Last active July 3, 2024 03:59
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@k3yavi
k3yavi / spacemacs-cheatsheet.txt
Last active August 14, 2024 21:24 — forked from davoclavo/spacemacs-cheatsheet.md
Spacemacs cheatsheet
//from http://www.saltycrane.com/blog/2015/12/switching-emacs-vim-actually-spacemacs/
Useful Spacemacs commands
SPC q q - quit
SPC w / - split window vertically
SPC w - - split window horizontally
SPC 1 - switch to window 1
SPC 2 - switch to window 2
SPC w c - delete current window
@stigok
stigok / githook.js
Last active July 8, 2024 14:56
Verify GitHub webhook signature header in Node.js
/*
* Verify GitHub webhook signature header in Node.js
* Written by stigok and others (see gist link for contributor comments)
* https://gist.github.com/stigok/57d075c1cf2a609cb758898c0b202428
* Licensed CC0 1.0 Universal
*/
const crypto = require('crypto')
const express = require('express')
const bodyParser = require('body-parser')
@benrules2
benrules2 / Gravity.py
Last active November 14, 2023 16:39
Python N-Body Orbit Simulation
import math
import random
import matplotlib.pyplot as plot
from mpl_toolkits.mplot3d import Axes3D
class point:
def __init__(self, x,y,z):
self.x = x
self.y = y