Skip to content

Instantly share code, notes, and snippets.

View enolan's full-sized avatar

Echo Nolan enolan

View GitHub Profile
// rev 6 (updated for cookieclicker 2)
// use as bookmarket:
javascript:var Util = { maxBy: function (arr, gt) { 'use strict'; return arr.reduce(function (p, c) { if (gt(p, c)) { return p; } else { return c; } }); }, buildingValue: function (b) { 'use strict'; /* I don't think Orteil has any idea how JavaScript is supposed to work*/ return b.cps(b)*Game.globalCpsMult/b.price; }};function Automaton() { 'use strict'; this.plannedBuy = false; this.rafId = 0; this.controlPanel = {};}Automaton.prototype.update = function () { 'use strict'; var buybuildings = document.getElementById("buybuildingscheckbox").checked; var buyupgrades = document.getElementById("buyupgradescheckbox").checked; var click = document.getElementById("clickcheckbox").checked; var goldenClick = document.getElementById("goldencheckbox").checked; if (click) {document.getElementById("bigCookie").click(
import Decidable.Equality
%default total
AtLeastTwo : Type -> Type
AtLeastTwo ty = Sigma (ty,ty) (\(a,b) => Not (a = b))
atLeastTwoNats : AtLeastTwo Nat
atLeastTwoNats = ((0,1) ** absurd)
atLeastTwoBools : AtLeastTwo Bool
Haskell: The Bad Parts
Complaining about a tiny program, armchair language design
What's the program? Pia-forward
A utility for setting up port forwarding on the Private Internet Access VPN service
- 103 lines
- Mostly IO
- Deals with exceptions
- JSON
- web service API
%default total
-- What's Idris?
-- * Dependently typed
-- * purely functional
-- * haskell-like syntax
-- Looks like this:
bottles : Nat -> String
bottles Z = "Buy more beer!"
bottles n@(S k) = show n ++

Keybase proof

I hereby claim:

  • I am enolan on github.
  • I am enolan (https://keybase.io/enolan) on keybase.
  • I have a public key whose fingerprint is 98FE 410B F035 E5A9 CEFD 7909 7B01 2803 D27E 62E3

To claim this, I am signing this object:

Tue Oct 6 16:59:24 PDT 2009 Echo Nolan <echo@echonolan.net>
* Fix Iter.take delaying actions one step.
It was broken in two maddeninly subtle ways. The first: using joinIM delayed
all actions associated with take's parameter iteratee one step. The second:
it always returned Cont when the length of the chunk was <= the requested
length and non-null. Thus, the values returned were one step delayed if the
amount to take was equal to the length of the chunk passed.
New patches:
{-
Read from a tcp socket and copy the stream to stdout using iteratee-based I/O.
To try this: in GHCI, run testEnumSocket; in another terminal, run
'nc localhost 31337'. Anything typed in the netcat terminal will show up in the
GHCI terminal. Go nuts!
Needs network-bytestring and iteratee from Hackage.
-}
module IterateeNetcat where
import qualified Data.ByteString as B
; Goal: Turn Array `["foo", "bar", "baz"]` into String `"ordered: 1=foo 2=bar 3=baz"`.
; Clojure
;; Read arguments from command line
;; (def argv *command-line-args*)
;; Fake command-line arguments for use in REPL
(def argv (seque ["foo" "bar" "baz"]))
data BEncode = BInt Integer
| BString ByteString
| BList [BEncode]
| BDict (Map ByteString BEncode)
deriving (Eq, Ord, Show)
getInt i = case i of
BInt i' -> Just i'
_ -> Nothing
getString s = case s of
# Modified for pulseaudio by Echo Nolan <echo@echonolan.net>
# Contributor: Slumslayer <paul.smet [at] gmail [dot] com>
# Original Contributor: Fabio Linux <fbo.linux [at] gmail [dot] com>
pkgname=mplayer-nogui-pulse
pkgver=28347
pkgrel=4
pkgdesc="A movie player for linux"
arch=(i686 x86_64)
depends=('libxxf86dga' 'libxv' 'libgl' 'faac' 'ttf-dejavu')