Skip to content

Instantly share code, notes, and snippets.

@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 / createiso-demo.ps1
Last active April 9, 2024 14:03
Demo for PowerShell script to create ISO using IMAPI COM component, as a simplification for StackOverflow answer http://stackoverflow.com/a/8325316/223837
# Inspiration from
#
# http://blogs.msdn.com/b/opticalstorage/archive/2010/08/13/writing-optical-discs-using-imapi-2-in-powershell.aspx
#
# and
#
# http://tools.start-automating.com/Install-ExportISOCommand/
#
# with help from
#
@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 / Remove-File-Eventually.ps1
Created November 20, 2013 15:47
PowerShell command to delete a file, if possible immediately, and if it is in use at the next boot.
param(
[parameter(Mandatory=$true)]
[string] $path
)
# the code below has been used from
# https://blogs.technet.com/b/heyscriptingguy/archive/2013/10/19/weekend-scripter-use-powershell-and-pinvoke-to-remove-stubborn-files.aspx
# with inspiration from
# http://www.leeholmes.com/blog/2009/02/17/moving-and-deleting-really-locked-files-in-powershell/
# and error handling from
@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 / 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 & }