Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Google ought to make a phone called the Google Jaw, or gJaw, which we could use to access the Reticulum.
When choosing a technology, "because it's what you know" is always a good reason, but it's not always a good _enough_ reason.
@qpliu
qpliu / gist:9280429
Created February 28, 2014 21:36
On the size of futuristic 3D image files

On the size of futuristic 3D image files

Futuristic 3D displays

The type of futuristic 3D display I'm considering would be pixel-based flat surface, like today's displays. The futuristic part is that each pixel controls what color gets emitted in a number of directions.

If such a display were used to display a 3D image, then it should be like looking through a window, where different viewing angles give the

-- A friend interviewed at Google and was given the task of
-- making a linked list from a binary tree where an element's
-- next element is its sibling, or null where there is none.
-- Example:
-- A
-- / \
-- / \
-- B C
-- / / \
@qpliu
qpliu / gist:3259111
Created August 4, 2012 18:14
Half-baked proposal: Error-return statement for Go (golang)

Half-baked proposal: Error-return statement for Go (golang)

Code in Go that propagates errors can get pretty verbose. For example:

    a, err := ...
    if err != nil {
            return nil, err
    }

b, err := ...

@qpliu
qpliu / DCPU16.hs
Created April 6, 2012 04:45
Implementation of version 1.1 of http://0x10c.com/doc/dcpu-16.txt
-- Implementation of version 1.1 of http://0x10c.com/doc/dcpu-16.txt.
-- This work is public domain.
module DCPU16 where
import Control.Monad(foldM)
import Data.Array.IO(IOArray)
import Data.Array.MArray(newListArray,readArray,writeArray)
import Data.Bits((.&.),(.|.),shiftL,shiftR,xor)
import Data.Ix(Ix)
import Data.Word(Word16,Word32)
@qpliu
qpliu / gist:875594
Created March 18, 2011 03:50
Exploring lists as instances of MonadPlus in Haskell by implementing filter
> import Control.Monad(MonadPlus(mzero),liftM,unless)
The regular filter can be implemented recursively:
> f1 _ [] = []
> f1 test (a:as) | test a = a : f1 test as | otherwise = f1 test as
Or the recursion can be abstracted:
> f2 test list = foldr (\ a rest -> if test a then a : rest else rest) [] list