Skip to content

Instantly share code, notes, and snippets.

Matthew Hall mattyhall

Block or report user

Report or block mattyhall

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattyhall
mattyhall / counter.rs
Created Jul 13, 2018
A Rust version of Python's counter
View counter.rs
use std::cmp::Eq;
use std::collections::HashMap;
use std::hash::Hash;
#[derive(Debug)]
struct Counter<V>
where
V: Eq + Hash,
{
map: HashMap<V, i32>,
View seti_image_render.py
import Image
# I apologise to the Python Gods. I was in a rush. This should all be one string and therefore one line!
data = '000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000 000000000000000000000000001000000000000000000000000000111 000000000000000000000000000000000000000000000000000000000 000000000000111100000000000000000000001101000000000000000 000000000000000000000000000000000000000000000000000000001 001100000000000000000011001000000000000000000000000000000 000000000000000000000000000000000000000000010001000000111 100000110000100000000000000
View gist:9237865
struct TestData {
x: int
}
impl TestData {
pub fn addition(&mut self) {
self.x += 10;
}
}
@mattyhall
mattyhall / NeuralNetwork.hs
Created Oct 23, 2013
Neural Networks in Haskell with Control.Lens
View NeuralNetwork.hs
{-# LANGUAGE TemplateHaskell, Rank2Types #-}
module NeuralNetwork where
import Control.Lens
import Control.Monad (mapM_)
import Control.Monad.State
import qualified Data.Vector as V
import Data.Vector.Lens
type NetworkState a = State Network a
@mattyhall
mattyhall / NBT.hs
Created Oct 3, 2013
An NBT parser written in Haskell
View NBT.hs
module Minecraft.NBT (findTag, indexTag, mapTag, parseNBT, Tag(..)) where
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString.Lazy as BL
import qualified Codec.Compression.Zlib as ZL
import qualified Codec.Compression.GZip as GZ
import qualified Data.Map as M
import Data.Attoparsec.Lazy as AP
import Data.Attoparsec.Binary
import Data.Word
You can’t perform that action at this time.