Skip to content

Instantly share code, notes, and snippets.


  • Zero page
View GitHub Profile
import mmap
import cffi
ffi = cffi.FFI()
ffi.cdef("struct test { int x; };")
ref = None
def alloc():
darkf /
Last active Mar 24, 2019
Computer Languages darkf Claims To Know

Computer Languages darkf Claims To Know

Main Programming Languages

  • C
  • C++
  • C#
  • Java
darkf / easing.js
Created Aug 11, 2017 — forked from gre/easing.js
Simple Easing Functions in Javascript - see
View easing.js
* Easing Functions - inspired from
* only considering the t value for the range [0, 1] => [0, 1]
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
View turingmachine.c
#include <stdio.h>
#include <assert.h>
#include <string.h>
// unfortunately there does not exist a magical computer with unbounded memory for an infinite tape
#define TAPE_SIZE 64
typedef struct {
char symbol; // input symbol
char write; // output symbol
darkf /
Created Mar 20, 2017
A quick script for seeing the intersection between contributors to different GitHub repositories
from github import Github
from collections import Counter
import sys
USER = None
def get_repo(repo_name):
contribs = list(g.get_repo(repo_name).get_contributors())
import random
# types are first class
List :: Type
List[Int] :: Type # just List indexed by another type ;)
xs = [1, 2, 3] # inferred type: xs :: List[Int]
for(xs, print)
darkf / PrimeEnc.hs
Last active Sep 7, 2016
Baseless number encoder
View PrimeEnc.hs
import Data.Numbers.Primes (primes, primeFactors)
import Data.List (elemIndex)
import Control.Monad (forM_)
data N = P N | Z | Prod [N] deriving (Eq, Show)
primes' = 1 : primes
primeIndex n = let Just idx = elemIndex n primes' in idx
encode :: Int -> N

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.

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
You can’t perform that action at this time.