Skip to content

Instantly share code, notes, and snippets.

@marnix
marnix / Ghilbert expexp: structured calculational proof
Created May 1, 2014 19:27
Ghilbert expexp: structured calculational proof
$
\newcommand{\calc}{\begin{align} \quad &}
\newcommand{\calcop}[2]{\notag \\ #1 \;\;\; & \;\;\; \langle\mbox{#2}\rangle \notag \\ \quad & }
\newcommand{\endcalc}{\notag \end{align}}
\newcommand{\subcalc}{\quad \begin{aligned} \\ \bullet \quad &}
\newcommand{\subcalcop}[2]{\calcop{#1}{#2} \subcalc}
\newcommand{\endsubcalc}{\notag \end{aligned} \\ \\ \cdot \quad &}
\newcommand{\nextsubcalc}{\notag \end{aligned} \\ \\ & \subcalc}
$_(Referenced in [Ghilbert Google group thread 'Step theorem display and HTML typesetting'](https://groups.google.com/d/topic/ghilbert/44niyKKts_8/discussion).)_
@marnix
marnix / scala-di-from-comment-7789930.scala
Created March 2, 2012 06:27
This code is a copy (roughly reconstructed from reformatted and reordered parts in an abandoned Eclipse project) of the code that was originally in http://jonasboner.com/2008/10/06/real-world-scala-dependency-injection-di.html#comment-7789930.
trait BeeperDevice {
def beep(beepSound: String)
}
trait DependsOnBeeper {
protected val beeper: BeeperDevice
}
class Beeper extends BeeperDevice {
@marnix
marnix / repro-xmlschemaset-memoryleak.ps1
Created June 27, 2012 09:07
Demonstrate PowerShell memory leak with XmlSchemaSet
function cleanup() {
write-host "Cleaning up..."
remove-item $schemaFile
break
}
trap {
cleanup
}
@marnix
marnix / repro-xmlschemaset-memoryleak-partly-fixed.ps1
Created August 8, 2012 08:01
Following gist https://gist.github.com/3002649, this fixes the leak following a MSFT suggestion but introduces event loss
function cleanup() {
write-host "Cleaning up..."
remove-item $schemaFile
break
}
trap {
cleanup
}
function cleanup() {
write-host "Cleaning up..."
remove-item $schemaFile
break
}
trap {
cleanup
}
@marnix
marnix / pom.xml
Last active December 11, 2015 14:59
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>marnix.so</groupId>
<artifactId>maven-issues-repro</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
@marnix
marnix / maven-inconsistent-dependency-tree.txt
Last active December 11, 2015 14:59
Output of mvn dependency:tree -Dverbose=true, given https://gist.github.com/4618149.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-issues-repro
[INFO] task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree {execution: default-cli}]
[INFO] marnix.so:maven-issues-repro:jar:1.0-SNAPSHOT
[INFO] +- org.springframework.data:spring-data-jpa:jar:1.1.0.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-commons-core:jar:1.3.0.RELEASE:compile
@marnix
marnix / HQio-11.hs
Created April 20, 2017 18:03
null created by marnix - https://repl.it/HQio/11
-- first let's get the type signatures out of the way
band :: Integer -> Integer -> Integer
bor :: Integer -> Integer -> Integer
bnot :: Integer -> Integer
-- now a special case, to terminate the recursion for 'band';
-- this follows directly from the general definition below
a `band` b | a == a `div` 2 && b == b `div` 2 = - ((a `mod` 2) * (b `mod` 2))
@marnix
marnix / calc-env.md
Last active August 6, 2017 12:24
MathJax \calc

$% \require{begingroup} \begingroup \newcommand{\calc}{\begin{align} \quad &} \newcommand{\op}[1]{\ #1 \quad & \quad \unicode{x201c}} \newcommand{\hints}[1]{\mbox{#1} \ \quad & \quad \phantom{\unicode{x201c}} } \newcommand{\hint}[1]{\mbox{#1} \unicode{x201d} \ \quad & } \newcommand{\endcalc}{\end{align}} \newcommand{\subcalch}[1]{\ \quad & \quad #1 \ \quad &} \newcommand{\subcalc}{\quad \begin{aligned} \quad & \ \bullet \quad & }

#!/usr/bin/env python2
## !!! WARNING: THIS CODE COULD VERY WELL REMOVE YOUR SYSTEM-WIDE
## plaitpy AND bda.basen PACKAGES !!!
# verify that we start with a clean slate: no plaitpy, no bda.basen
import os
assert not os.path.isfile('/usr/local/lib/python2.7/dist-packages/plaitpy/__init__.py')
try:
import plaitpy # this fails, as expected