Skip to content

Instantly share code, notes, and snippets.

View tosh's full-sized avatar
💭
🍄🌈

Thomas Schranz tosh

💭
🍄🌈
View GitHub Profile
@vsavkin
vsavkin / transducers.dart
Last active December 15, 2015 16:22
Transducers in Dart
library transducers;
import 'dart:async';
reduce(coll, Function fn, init) {
// Reduce function for Iterable.
if (coll is Iterable) {
var result = init;
final iterator = coll.iterator;
while (iterator.moveNext()) {
@mfikes
mfikes / source.md
Last active December 27, 2016 20:04
Source for C and ClojureScript comparison
@alastairs
alastairs / Cambridge Software Crafters Email.md
Last active April 12, 2018 12:40
Email to the Cambridge Software Crafters re: name change and CoC

Changes to the Cambridge Software Craftsmanship Community

Hi everyone

It's not often that we email our members, so please bear with me and read this to the end.

Recent events in the wider tech community, and reactions within the Software Craftsmanship community, have prompted wider discussions about the inclusiveness of the community, and I've decided to make some small but important changes to our local chapter.

@borkdude
borkdude / sci_google_cloud.js
Last active March 1, 2020 13:21
Google cloud function running sci
const { evalString } = require("@borkdude/sci");
let printlnArgs = [];
function println(...args) {
printlnArgs.push(args.map(arg => arg.toString()).join(" "));
}
exports.evalClojureExpr = (req, res) => {
const { text } = req.body;
@searls
searls / do-this.js
Created May 24, 2020 04:05
How to play web audio that won't interrupt background system-wide audio playback in iOS
let audioContext
export function play (url) {
const AudioContext = window.AudioContext || window.webkitAudioContext
if (!audioContext) audioContext = new AudioContext()
const request = new window.XMLHttpRequest()
request.open('GET', url, true)
request.responseType = 'arraybuffer'
request.addEventListener('load', function (e) {
const source = audioContext.createBufferSource()
source.buffer = audioContext.createBuffer(request.response, false)
@AUnterrainer
AUnterrainer / book_recs.md
Created March 16, 2020 21:35
List of books I've used either in class or found through other channels; spans Python, Java, C, C++, Finance, Data Science, Hacking:

Finance & Trading

Portfolio Selection, Markowitz
Volatility Smile, Derman
Adaptive Markets, Lo
Python for Finance, Hilpisch
Advances in Financial ML, de Prado
Listed Vol & Variance Derivatives, Hilpisch
Artificial Intelligence in Finance, Hilpisch
Diary of a Professional Commodity Trader, Brandt
Market Timing with Moving Averages, Zakamulin

@chrispsn
chrispsn / compression.js
Created August 20, 2019 09:09
Exercise in writing compressed JavaScript using b-like techniques
// Inspired by http://kparc.com/b/c.h
// See also https://chat.stackexchange.com/transcript/message/51402407#51402407
const x="x",y="y"
// Function makers
function fn() {return new Function(...arguments)}
function f0(b) {return fn(b)}
function f1(b) {return fn(x,b)}
function f2(b) {return fn(x,y,b)}
#!/usr/bin/python3
# Solution to the challenge at https://gist.github.com/ehmo/7f515ac6461c1c4d3e5a74f12e6eb5ea
# Sample solution: https://twitter.com/marcan42/status/1428933147660492800
#
# Given an input base image, computes two derivative images that have different
# perceptual hashes, yet differ by only one pixel.
#
# Usage: hash_bisector.py <input.png> <output_a.png> <output_b.png>
#
# Licensed under the terms of the STRONGEST PUBLIC LICENSE, Draft 1:
@borkdude
borkdude / aoc21_01.clj
Last active December 22, 2021 02:32
Advent of Code 2021 - in Clojure / babashka 0.6.8
(ns aoc21-01
(:require [clojure.string :as str]))
(def input (map parse-long (str/split-lines (slurp "input.txt"))))
(defn answer-01 [input]
(count (filter true? (map < input (rest input)))))
(def three-sliding-window
(map + input (next input) (nnext input)))
@fasiha
fasiha / learn_datalog_today.clj
Created May 10, 2016 03:32
Learn Datalog Today ported to DataScript & Clojure (JVM)
; Learn Datalog Today (http://www.learndatalogtoday.org) is a great resource for
; reading but its interactive query interface is broken. Below is how we can
; load the same data into a Clojure REPL and play with it using DataScript.
; After running the code below, many/most/all? of the queries on Learn Datalog
; Today should be functional.
;
; Create a new lein project, add `[datascript "0.15.0"]` to `project.clj`'s
; `dependencies`, run `lein deps && lein repl` and copy-paste the following in
; chunks, inspecting the outputs as needed.