Skip to content

Instantly share code, notes, and snippets.

@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
@kachayev
kachayev / concurrency-in-go.md
Last active March 11, 2024 11:27
Channels Are Not Enough or Why Pipelining Is Not That Easy
@jackrusher
jackrusher / negative-space.clj
Last active November 17, 2017 19:30
Clojure, Haskell and OCaml implementations of the same algorithm, which is a negative space finder for a very constrained situation involving nested rectangles. For those interested in a more comprehensive take on these relationships (using scheme rather than clojure), see: http://lambda.jimpryor.net/translating_between_ocaml_scheme_and_haskell/
(def parent {:x1 0 :y1 0 :x2 600 :y2 400})
(def rs [{:x1 0 :y1 0 :x2 300 :y2 200 }
{:x1 0 :y1 200 :x2 300 :y2 400 }])
(defn negative-space [parent rs]
(let [x (apply max (map :x2 rs))
y (apply min (map :y1 (filter (comp (partial = x) :x2) rs)))]
{:x1 x :y1 y :x2 (parent :x2) :y2 (parent :y2)}))
(negative-space parent rs)
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@steeve
steeve / _readme.md
Last active March 7, 2024 12:38
How to cross compile Go with CGO programs for a different OS/Arch

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

@danneu
danneu / golang-vs-clojure-async.md
Last active November 6, 2023 04:09
Google I/O 2012 - Go Concurrency Patterns ported to Clojure Video: http://www.youtube.com/watch?v=f6kdp27TYZs
@jackrusher
jackrusher / gist:5139396
Last active March 29, 2023 21:02
Hofstadter on Lisp: Atoms and Lists, re-printed in Metamagical Themas.

Hofstadter on Lisp

In the mid-80s, while reading through my roommate's collection of Scientific American back issues, I encountered this introduction to Lisp written by Douglas Hofstadter. I found it very charming at the time, and provide it here (somewhat illegally) for the edification of a new generation of Lispers.

In a testament to the timelessness of Lisp, you can still run all the examples below in emacs if you install these aliases:

(defalias 'plus #'+)
(defalias 'quotient #'/)
(defalias 'times #'*)
(defalias 'difference #'-)
@freeformz
freeformz / WhyILikeGo.md
Last active October 6, 2022 23:31
Why I Like Go

A slightly updated version of this doc is here on my website.

Why I Like Go

I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.

Goroutines

The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x), where f() is a function.

@cqfd
cqfd / gist:4049153
Created November 10, 2012 00:03
Blog post on unfolding the BitTorrent peer protocol

i'm doing a bittorrent client in erlang

task: parse a lump of raw binary data from a socket into a list of bittorrent messages

my original implementation worked but was messy; the logic for parsing individual bittorrent messages was tangled with the logic for accumulating them into a list [should show this, ought to be somewhere in github.com/happy4crazy/ebc]

###
# Scheme code is translated to YARV byte code, then evaluated in the
# Ruby Virtual Machine
require 'rbconfig'
require 'dl'
require 'fiddle'
require 'strscan'
class RubyVM