Skip to content

Instantly share code, notes, and snippets.

View cwvh's full-sized avatar

Chris Van Horne cwvh

  • Seattle, WA, USA
View GitHub Profile
@cwvh
cwvh / B.hs
Last active January 2, 2016 06:29
{-# LANGUAGE OverloadedStrings #-}
import Data.Array.IO
import Data.Array.Base
import Control.Applicative
import Control.Monad
import Data.Attoparsec.Char8
import qualified Data.ByteString.Char8 as B
import System.Environment
data Primitive =
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <boost/spirit/include/qi.hpp>
namespace ast
{
struct Left
{
@cwvh
cwvh / bf.hs
Last active May 18, 2018 01:50
Haskell brainfuck interpreter.
{-# LANGUAGE OverloadedStrings #-}
import Data.Array.IO
import Data.Array.Base
import Control.Applicative
import Control.Monad.Loops
import Data.Either
import Data.Attoparsec.Char8
import qualified Data.ByteString.Char8 as B
import System.Environment
@cwvh
cwvh / init.el
Created January 1, 2014 01:48
~/.emacs.d/init.el
(setq initial-scratch-message nil)
(setq inhibit-startup-message t)
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
(prefer-coding-system 'utf-8)
(setq make-backup-files nil)
(setq auto-save-default nil)
(global-font-lock-mode t)
(setq ring-bell-function 'ignore)
@cwvh
cwvh / factorial.bf
Created December 29, 2013 03:51
factorial.. incorrect prints for values larger than 1000.
+++++++++++++++++++++++++++++++++ c1v33 : ASCII code of !
>++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++ c2v61 : ASCII code of =
>++++++++++ c3v10 : ASCII code of EOL
>++++++++++ c4v7 : quantity of numbers to be calculated
> c5v0 : current number (one digit)
>+ c6v1 : current value of factorial (up to three digits)
<< c4 : loop counter
[ block : loop to print one line and calculate next
>++++++++++++++++++++++++++++++++++++++++++++++++. c5 : print current number
@cwvh
cwvh / mandelbrot.bf
Created December 29, 2013 03:50
mandelbrot, very slow execution
A mandelbrot set fractal viewer in brainf*** written by Erik Bosman
+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[
>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+
<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>
>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>>
>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>>
>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>>
>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>
[>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<+<<]>>>>>>>>]<<<<<<<<<[<<<<<<<
<<]>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<<<]>>>>>>>>>+++++++++++++++[[
@cwvh
cwvh / trace.txt
Last active December 31, 2015 00:19
trace_file_name,compression_algorithm,compression_threshold,spin_down_timeout,total_read_time,read_count,avg_read_time,total_write_time,write_count,avg_write_time,processor_energy_used,disk_energy_used,total_energy_used,total_capacity_used,parse_error_occurred
../desktop.json,gzip,0,inf,5.037378788,141298,3.56507437331e-05,0.924479722976,68674,1.34618592622e-05,174.040380839,4132.71687376,4306.7572546,6159105,False
../desktop.json,gzip,0.4,inf,5.03730286599,141298,3.56502064148e-05,0.92584280094,68674,1.34817077925e-05,176.733297386,4132.51722896,4309.25052634,5458904.65255,False
../desktop.json,gzip,0.993,inf,6.21439429504,141298,4.3980766147e-05,0.927627723261,68674,1.35076990311e-05,237.778890911,4132.5098033,4370.28869421,5456605.6541,False
../desktop.json,gzip,inf,inf,38.3164515773,141298,0.000271174762398,2.35881293136,68674,3.43479764009e-05,1971.57854733,4132.49984377,6104.0783911,5454477.86557,False
../desktop.json,bzip2,0.4,inf,5.39169294615,141298,3.8158310423e-05,0.92622162101,68674,1.34872240005e
@cwvh
cwvh / Z.hs
Created December 5, 2013 05:32
connects to wss://echo.websocket.org fine, but fails with wss://websocket.mtgox.com
{-# LANGUAGE OverloadedStrings #-}
import Control.Exception
import Control.Monad
import Control.Monad.IO.Class
import qualified Network.Socket as S
import System.IO (IOMode (ReadWriteMode))
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L
@cwvh
cwvh / coreos.txt
Created November 22, 2013 23:45
coreos launch token
#
@cwvh
cwvh / hard.txt
Created November 4, 2013 03:11
SSEM factoring program description
00000000000000000000000000000000
01000000000000000000000000011000
01100000000000000000000000011010
01000000000000000000000000011010
01100000000000000000000000011011
01000000000000000000000000010111
10000000000000000000000000011011
11000000000000000000000000000000
00100000000000000000000000010100
10000000000000000000000000011010