Skip to content

Instantly share code, notes, and snippets.

James Adam Buckland ambuc

Block or report user

Report or block ambuc

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
View julia.go
package main
// Renders a series of julia_n.pngs which can be zipped together into a gif.
//
// Example usage:
// go run julia.go
// convert /tmp/julia*.png -loop 0 animation.gif
import (
"fmt"
View siteswap.hs
import Control.Arrow ((&&&))
import Data.List (delete, elemIndices, nub, permutations, sort)
import Data.Random.Distribution.Normal
import System.Random
-- FAUX LIBRARIES --
intToDigit35 :: Int -> Char
intToDigit35 i
| i >= 0 && i <= 9 = toEnum (fromEnum '0' + i)
@ambuc
ambuc / 10-s.json
Last active Sep 5, 2018
example envoy --config-path <path> file
View 10-s.json
{
"staticResources": {
"listeners": [
{
"name": "listener0",
"address": {
"socketAddress": {
"address": "0.0.0.0",
"portValue": 26300
}
View 1.rs
use std::str;
fn main() {
let input_string = String::from("5228833336355848549915459366737982598312959583817455621545976784792489468198365998232722734876612332352376192813552949814275947575774339529811976644361517795586998319242241614813622734255797569571577699238592667287428166398221572885869416419682687759743978434571821267146514338394624525648338739929479912368172669885577319718389278168766844487948761697438722556857882433224393723131298876252626643517236883999115665656935521675772866516185899317132494716723615493476397115627687887665194781746377341468995954554518252916859227397693885254329628812355612487594445522395853551734567498838382248616137969637971369615443599973588326388792893969924855316437952313492551671545714262784738343517166544197194547173515155927244175447296474282154114951181648317875827525814453758846194548872789943372281952995222779173812444186491115426476188672253249744478946863317915136832199132868917891243591195719354721129116229164688256853628339233919671468781913167415624214152793
@ambuc
ambuc / irrev-cube-2.hs
Created Sep 2, 2017
Puzzle Pong - Irreversible Cube II
View irrev-cube-2.hs
import Codec.Picture ( PixelRGBA8( .. ), writePng, Image)
import Control.Arrow (first,second,(***))
import Data.Function (on)
import Data.List (sort, nub, sortBy, groupBy, nubBy, delete, zip3, zip4, (\\))
import Data.List.Split (chunksOf)
import Data.Monoid ((<>))
import Data.Ord (comparing)
import Text.Printf
import Debug.Trace (trace)
import Cornea (Obj (..), World, mark, seenFrom, solid, render, isometric)
View Isometric.hs
module Isometric
( Obj (..) , World , isometric , mark , render , seenFrom , solid
) where
import Codec.Picture (PixelRGBA8 (..), writePng, Image)
import Data.Monoid ((<>))
import Data.Function (on)
import Data.List (transpose, genericLength, sortBy)
import Data.Ord (comparing)
import Data.Matrix (Matrix, fromList, toList, transpose)
@ambuc
ambuc / irrev-cube.hs
Created Aug 24, 2017
Puzzle Pong - Irreversible Cube I
View irrev-cube.hs
import Codec.Picture( PixelRGBA8( .. ), writePng, Image)
import Control.Arrow (first,second)
import Data.Function (on)
import Data.List (sort, nub, sortBy, groupBy, nubBy, delete, zip4, (\\), zipWith4)
import Data.List.Split (chunksOf)
import Data.Monoid ((<>))
import Data.Ord (comparing)
import Debug.Trace (trace)
import Graphics.Rasterific
import Graphics.Rasterific.Texture (uniformTexture)
@ambuc
ambuc / successive-rows.hs
Created Jul 15, 2017
Successive Rows of Horizontal, Straight Lines from Top to Bottom, and Vertical, Straight Lines from Left to Right, 1972
View successive-rows.hs
import Codec.Picture( PixelRGBA8( .. ), writePng )
import Graphics.Rasterific
import Graphics.Rasterific.Texture
import Graphics.Rasterific.Transformations
import Data.List
refl = transform $ applyTransformation
Transformation { _transformA = 0.0, _transformC = 1.0, _transformE = 0.0,
_transformB = 1.0, _transformD = 0.0, _transformF = 0.0
}
@ambuc
ambuc / crossword.hs
Last active May 28, 2017
Puzzle Pong - Generating All Possible 4x4 Crosswords
View crossword.hs
import qualified Control.Monad as N (forM)
import qualified Data.Maybe as B (isJust, isNothing, fromJust, catMaybes)
import qualified Data.Char as C (isAsciiLower)
import qualified Data.Function as F (on)
import qualified Data.List as L (all, nub, groupBy, intercalate)
import qualified Data.List.Split as L (chunksOf)
import qualified Data.Map.Strict as M (Map, insert, empty, unions, findWithDefault)
import qualified Language.Words as W (allStringWords)
type Box = Maybe Char
@ambuc
ambuc / graph.dot
Last active Apr 30, 2017
A Painting Puzzle
View graph.dot
digraph G {
size = "4,4";
"[1,1,1,1]" -> "[1,1,2]" [label="1"];
"[1,1,2]" -> "[1,1,2]" [label="1/2"];
"[1,1,2]" -> "[1,3]" [label="1/3"];
"[1,1,2]" -> "[2,2]" [label="1/6"];
"[1,3]" -> "[1,3]" [label="1/2"];
"[1,3]" -> "[2,2]" [label="1/4"];
"[1,3]" -> "[4]" [label="1/4"];
"[2,2]" -> "[1,3]" [label="2/3"];
You can’t perform that action at this time.