Skip to content

Instantly share code, notes, and snippets.

View mango314's full-sized avatar
💭
https://retrocomputing.stackexchange.com/questions/tagged/6502

JM mango314

💭
https://retrocomputing.stackexchange.com/questions/tagged/6502
View GitHub Profile
@mango314
mango314 / gaussreduction.py
Last active August 29, 2015 14:17
gauss reduction algorithm and cycles
def S((a,b,c), k=1):
return (a, -2*a*k+b, a*k**2-b*k+c)
def T((a,b,c)):
return (c,b,a)
x = (1,33,-21)
x = (7, 33, -8)
x = (13,13,-22)
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# http://stackoverflow.com/questions/11175131/code-for-greatest-common-divisor-in-python
def gcd(x, y):
while y != 0:
(x, y) = (y, x % y)
return x
@mango314
mango314 / limacon-1.md
Last active August 29, 2015 14:12
various constructions of the Limaçon curve

Wikipedia: Let P be a point and C be a circle whose center is not P. Then the envelope of those circles whose center lies on C and that pass through P is a limaçon.

@mango314
mango314 / subway.py
Last active February 20, 2017 21:41
parse subway gtfs
import requests
key = ''
r = requests.get('http://datamine.mta.info/mta_esi.php?key=%s&feed_id=1'%(key))
# http://datamine.mta.info/sites/all/files/pdfs/nyct-subway.proto.txt
# https://developers.google.com/transit/gtfs-realtime/gtfs-realtime-proto
# https://github.com/google/protobuf
import gtfs_realtime_pb2, nyct_subway_pb2
@mango314
mango314 / abc.md
Last active August 29, 2015 14:11

$$ \int $$

x = − b
@mango314
mango314 / 2048.html
Last active August 29, 2015 14:10
2048 clone - progress report
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<svg id="board" width=500 height=500></svg>
-- variant of tutorial
-- type "./notes" in terminal
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (forM_)
import Text.Blaze.Html5
import Text.Blaze.Html5.Attributes
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
@mango314
mango314 / command.sh
Created October 21, 2014 21:11
turning websites into Haskell
wget -O http://jaspervdj.be/blaze | blaze-from-html -v html4-transitional
#OR
curl -S http://jaspervdj.be/blaze | blaze-from-html -v html4-transitional
@mango314
mango314 / 1-helloworld.hs
Last active August 29, 2015 14:07
Having understood categories and monads, we give you...
-- http://hackage.haskell.org/package/pipes-text-0.0.0.12/docs/Pipes-Text-IO.html
-- http://hackage.haskell.org/package/pipes
-- http://hackage.haskell.org/package/pipes-text
import Pipes
import qualified Pipes.Text as Text
import qualified Pipes.Text.IO as Text
import System.IO
-- http://stackoverflow.com/questions/19521246/what-does-mean-do-in-haskell
@mango314
mango314 / mult.elm
Created August 2, 2014 22:08
define multiplication over lists
sum [2,3,4]
product [2,3,4]