Skip to content

Instantly share code, notes, and snippets.

View luciferous's full-sized avatar
🏠
Working from home

Neuman Vong luciferous

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am luciferous on github.
  • I am neuman (https://keybase.io/neuman) on keybase.
  • I have a public key whose fingerprint is 56E1 0C04 5C9C 1FDD 5F33 67F8 C644 D3A1 F6BD EABD

To claim this, I am signing this object:

@luciferous
luciferous / # python@2 - 2018-03-08_20-42-24.txt
Created November 21, 2018 04:23
python@2 on macOS 10.11.6 - Homebrew build logs
Homebrew build logs for python@2 on macOS 10.11.6
Build date: 2018-03-08 20:42:24
layout title date comments author categories commentIssueId
post
A comonad of graph decompositions
2016-04-02 13:02:54 -0400
true
Rúnar
scala comonads
22
@luciferous
luciferous / 481.md
Last active June 27, 2016 22:28
sharp resize + png
@luciferous
luciferous / help.md
Created June 25, 2016 00:37
Bazel: Python modules

Why does Bazel build the Python module under app? Is there a parameter to make it build foo so that I can write from foo import bar? (Note: if I change foo_test.py to use from app.foo import bar the command below succeeds.)

This is my directory structure.

$ find .
.
./app
./app/foo
./app/foo/__init__.py
@luciferous
luciferous / Main.hs
Last active July 16, 2016 06:18
STM example
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Network ( withSocketsDo, listenOn, PortID(..) )
import Network.Socket ( accept, close, recv, send, Socket )
import Control.Concurrent ( forkIO, threadDelay, ThreadId )
import Control.Concurrent.STM ( atomically
, orElse
, newTChan
, readTChan
@luciferous
luciferous / TestClose.scala
Created March 8, 2016 08:13
Test socket closed by remote
import com.twitter.finagle.Http
import com.twitter.finagle.http.{Http => _, _}
import com.twitter.io.{Buf, Reader}
import com.twitter.util.Await
val tls = Http.client.withStreaming(enabled=true).withTlsWithoutValidation.newService("localhost:4433")
val plain = Http.client.withStreaming(enabled=true).newService("localhost:3000")
val tlsReq = Request(Version.Http11, Method.Get, "/", Reader.writable())
val tlsRes = Await.result(tls(tlsReq).liftToTry)
@luciferous
luciferous / Main.hs
Created December 20, 2015 00:45
HTTP Basic Authentication with Servant
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeOperators #-}
module Main where
import Control.Monad.Trans.Either
import Data.Aeson
import GHC.Generics
import Servant
@luciferous
luciferous / gist:1846c46b9870cbd729ce
Last active December 1, 2015 07:31 — forked from anonymous/gist:7aa72601f708150a2870
HttpStreamingServer for mpeg2 videos
import com.twitter.finagle.http
import com.twitter.conversions.time._
import com.twitter.finagle.http.{Request, Response, Status}
import com.twitter.finagle.{Http, Service}
import com.twitter.io.{Buf, Reader, Writer}
import com.twitter.util.{Await, Future, Base64StringEncoder}
import sys.process._
object HttpStreamingServer extends App {
sealed trait Value
sealed trait Prim[A] extends Value {
def value: A
}
case class StringPrim(value: String) extends Prim[String]
val x: Value = StringPrim("hi")
def get[A](v: Value): Option[A] = v match {
case p: Prim[A] => Some(p.value)
case _ => None