Skip to content

Instantly share code, notes, and snippets.

@michaelpj
michaelpj / scala2.10.1-RC1broken.scala
Last active December 14, 2015 04:19
Weird implicts problem in Scala 2.10.1-RC1.
import scalaz.Pointed
import scalaz.Scalaz._
trait Doobie[A]
object Doobie {
implicit def doobiePointed = new Pointed[Doobie] { def point[A](a: => A) = new Doobie[A]() {}; def map[A, B](d: Doobie[A])(f: A => B) = ??? }
}
object Foo {
from int n
where n in [1..5]
and n = max(int m | m = n +1)
select n
@michaelpj
michaelpj / keybase.md
Created November 21, 2015 17:57
keybase.md

Keybase proof

I hereby claim:

  • I am michaelpj on github.
  • I am michaelpj (https://keybase.io/michaelpj) on keybase.
  • I have a public key whose fingerprint is 1467 08F4 9CF9 18E7 A179 FD2D C785 EF06 E1E7 13F3

To claim this, I am signing this object:

@michaelpj
michaelpj / gist:0fd38ca6adc7b6f164c3
Created January 12, 2016 16:45
Jenkins stack trace on saving config
javax.servlet.ServletException: java.lang.RuntimeException: Failed to instantiate class org.jenkinsci.plugins.ghprb.GhprbTrigger from {"gitHubAuthId":"2b1371ad-0f80-42d5-b5f6-8b1daca3b1b5","adminlist":"","useGitHubHooks":false,"triggerPhrase":"","onlyTriggerPhrase":false,"autoCloseFailedPullRequests":false,"skipBuildPhrase":"","displayBuildErrorsOnDownstreamBuilds":false,"cron":"H/5 * * * *","whitelist":"","orgslist":"","allowMembersOfWhitelistedOrgsAsAdmin":false,"permitAll":false,"buildDescTemplate":"","whiteListTargetBranches":{"branch":""},"extensions":{"stapler-class":"","$class":""}}
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
at org.kohsuke.stapler.Stapler.invoke(Stapl
08:20:51.333 [2016-01-13 05:57:12] [ 25.0%] ERROR: Failed to compile /home/jenkins/slave/workspace/ODASA/OS/Nessie/target/general/plsql-queries-qlos/1-of-8/plsql-queries-qlos.zip.contents/queries/semmlecode-plsql-queries/Metrics/CyclomaticComplexity.ql:
08:20:51.333 - Internal error when compiling /home/jenkins/slave/workspace/ODASA/OS/Nessie/target/general/plsql-queries-qlos/1-of-8/plsql-queries-qlos.zip.contents/queries/semmlecode-plsql-queries/Metrics/CyclomaticComplexity.ql:
08:20:51.333 com.semmle.util.exception.InternalError: java.lang.OutOfMemoryError: GC overhead limit exceeded
08:20:51.333 com.semmle.inmemory.MemoryBackend.prepareQueryWithTimeout(MemoryBackend.java:305)
08:20:51.333 com.semmle.inmemory.MemoryBackend.compileQuery(MemoryBackend.java:314)
08:20:51.333 com.semmle.api.QueryToCompile.compile(QueryToCompile.java:143)
08:20:51.333 com.semmle.api.QueryToCompile
@michaelpj
michaelpj / gist:26fb0445c40a542343ab
Created January 21, 2016 18:17
PLSQL build failure
mv output-antlr/input-antlr/* output-antlr
mv: cannot stat ‘output-antlr/input-antlr/*’: No such file or directory
Command failed: mv output-antlr/input-antlr/* output-antlr
Makefile:137: recipe for target 'output-antlr/SqlPlusBaseVisitor.java' failed
make[1]: *** [output-antlr/SqlPlusBaseVisitor.java] Error 255
make[1]: *** Waiting for unfinished jobs....
mv output-antlr/input-antlr/* output-antlr
mv output-antlr/input-antlr/* output-antlr
mv: cannot move ‘output-antlr/input-antlr/SqlPlus.tokens’ to ‘output-antlr/SqlPlus.tokens’: No such file or directory
mv: cannot stat ‘output-antlr/input-antlr/SqlPlusBaseVisitor.java’: No such file or directory
@michaelpj
michaelpj / gist:c3726a9a4b35daa048ce
Created January 26, 2016 17:55
Mend hanging stack
"main" #1 prio=6 os_prio=0 tid=0x00007f5ca400a800 nid=0x39b8 runnable [0x00007f5cab7ef000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:160)
at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:84)
at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:273)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
@michaelpj
michaelpj / fib.plc
Created September 4, 2018 12:29
Big fib
(program 1.0.0
[
(lam
fib_37
(fun [(con integer) (con 64)] [(con integer) (con 64)])
[ fib_37 (con 64 ! 4) ]
)
[
{
{
delay :: MonadQuote m => (PC.Term PC.TyName PC.Name ()) -> m (PC.Term PC.TyName PC.Name ())
delay body = PC.LamAbs () <$> safeFreshName "thunk" <*> liftQuote Unit.getBuiltinUnit <*> pure body
delayType :: MonadQuote m => (PC.Type PC.Tyname ()) -> m (PC.Type PC.Tyname ())
delayType orig = PC.TyFun () <$> liftQuote Unit.getBuiltinUnit <*> pure orig
force :: MonadQuote m => (PC.Term PC.TyName PC.Name ()) -> m (PC.Term PC.TyName PC.Name ())
force thunk = PC.Apply () thunk <$> liftQuote Unit.getBuiltinUnitval
delayFunction :: MonadQuote m => (PC.Type PC.Tyname ()) -> (PC.Term PC.TyName PC.Name ()) -> m (PC.Term PC.TyName PC.Name ())
@michaelpj
michaelpj / gist:23dcc65a76682a745310145669aa07ed
Last active September 7, 2018 09:01
Scott-encoded pair with type lambdas
-- In "readable" notation. "Definitions" are for clarity and will in fact all appear inline.
Pair :: * -> * -> *
Pair =
-- type params
\a :: * . \b :: * .
-- match output type
forall t :: * .
-- matcher type
a -> b -> t