Skip to content

Instantly share code, notes, and snippets.

Avatar

darkf

  • Zero page
View GitHub Profile
View AFreeBrowserForAll.md

A Free Browser For All

Today's Web is in a state of disarray. We are constantly being bombarded by advertisements (possibly malicious!), trackers, malware scripts, and bloated JavaScript-heavy websites which put too much effort into being complicated.

We want a browser liberated from these plagues: a browser that is built from the ground up for privacy, liberty and security. We want a browser that does not bow down to the status quo and accept "You shalt be tracked."

A browser that does not exist for spending 1% of your battery life on fetching, parsing, compiling and running JavaScript just to display the basic layout of a page.

We want a liberated browser, for humans to use in order to safely and efficiently communicate with the wasteland that the Web is today.

@darkf
darkf / bf.ml
Created May 30, 2013
Brainfuck interpreter in OCaml
View bf.ml
let eval str =
let cells = Array.make 4096 0 in
let ptr = ref 0 in
let len = String.length str in
let rec evalbf c =
if c >= len then
c
else
match String.get str c with
@darkf
darkf / lc.hs
Created Mar 5, 2014
Simply typed lambda calculus interpreter in Haskell
View lc.hs
import Data.Maybe (fromJust)
data Type = IntTy
| ArrowTy Type Type
deriving (Show, Eq)
data Term = Const Int
| Var String
| Abs String Type Term
| App Term Term
View ANN.hs
type Weight = Float
type Bias = Float
-- type Neuron = Bias -> [Weight] -> [Float] -> Float
-- Artificial neuron, given some activation function f.
-- A neuron is simply a function from a vector of weights, and a vector of values, to an activation value.
neuron :: (Float -> Float) -> Bias -> [Weight] -> [Float] -> Float
--neuron :: (Float -> Float) -> Neuron
neuron f b ws xs = f (sum (zipWith (*) ws xs) + b)
View Perceptron.hs
type Weight = Float
type Threshold = Float
perceptron :: [Weight] -> Threshold -> [Float] -> Bool
perceptron ws t xs = sum (zipWith (*) ws xs) >= t
-- OR gate
or_p = perceptron [1, 1] 1
-- AND gate
View lolnominaltyping.ts
interface Point2D {
x: number;
y: number;
}
interface Point3D extends Point2D {
z: number;
}
function f(pt: Point2D) {}
View HufmanBenchBS.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
import Data.List
import Data.Ord (comparing)
import Control.Applicative ((<|>))
import Criterion.Main
import GHC.Generics (Generic)
import Control.DeepSeq
@darkf
darkf / sdl_test.nim
Last active Dec 31, 2015
SDL test in Nimrod
View sdl_test.nim
import math
import sdl
const
WIDTH = 1024
HEIGHT = 768
TIMESTEP = 1000 div 30 # 30 fps
THING_WIDTH = 32
@darkf
darkf / interp_pattern.hs
Created Oct 18, 2013
Interpreter for a simple dynamically typed pattern matching language
View interp_pattern.hs
-- Interpreter for a simple dynamically typed pattern matching language
-- Copyright (c) 2013 darkf
-- Written on 10/18/2013
import Control.Monad.State (State, runState, evalState, get, put)
import qualified Data.Map as M
data AST = Add AST AST
| Def String AST
| Var String
@darkf
darkf / interp.hs
Last active Dec 25, 2015
Barebones interpreter in Haskell showing `State s a`
View interp.hs
import Control.Monad.State (State, runState, evalState, get, put)
import qualified Data.Map as M
data AST = Add AST AST
| Def String AST
| Var String
| StrConst String
| IntConst Int
deriving (Show, Eq)
You can’t perform that action at this time.