Skip to content

Instantly share code, notes, and snippets.

View metasim's full-sized avatar
🇺🇦

Simeon H.K. Fitch metasim

🇺🇦
View GitHub Profile
@metasim
metasim / wulf-quote.txt
Created July 14, 2010 14:02
Common quote on computing sins.
"More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason-including blind stupidity."
--W. A. Wulf
@metasim
metasim / c-ify.sh
Created June 23, 2011 13:28
Poor man's resource compiler
#!/bin/bash
# Poor man's resource compiler
# Converts given file into compilable byte stream via
# C code header and implementation files.
# Based on original by http://www.linuxjournal.com/users/mitch-frazier
#
if [[ $# -ne 1 ]]; then
echo "Usage: $0 FILENAME"
exit 1
@metasim
metasim / ant-build-frag.xml
Created January 2, 2012 21:20
Disk image creation fragment
<!-- Fragment from an Ant build.xml file for creating a disk image with bells and whistles. -->
<property name="dmgname" value="${build.dir}/install-${name}.dmg" />
<property name="tmpdmg" value="/tmp/${app.name}-installer-tmp.dmg" />
<property name="volname" value="${app.name}-${VERSION}-Install" />
<delete file="${tmpdmg}" quiet="yes" failonerror="false" />
<!-- Create the temporary image -->
<echo>Making initial image...</echo>
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
Process: java [98221]
Path: /usr/bin/java
Identifier: com.apple.javajdk16.cmd
Version: 1.0 (1.0)
Code Type: X86-64 (Native)
Parent Process: eclipse [8499]
User ID: 224742261
PlugIn Path: /Users/USER/*/libvtkFiltering.5.10.dylib
PlugIn Identifier: libvtkFiltering.5.10.dylib
@metasim
metasim / VTK 6.0.0 Minimal Java Config
Created July 29, 2013 21:03
CMake Config for VTK 6.0 w/Java
# This is the CMakeCache file.
# For build in directory: /CODE/VTK6.0.0
# It was generated by CMake: /usr/local/Cellar/cmake/2.8.10.1/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.
@metasim
metasim / on-scala.md
Last active December 22, 2015 07:29
Example reveal.js markdown input, content from in-progress presentation on Scala

What is Scala?

  • A modern, statically typed programming language built upon the Java ecosystem
  • Elegant mix of object orientation and functional programming paradigms
  • Designed to be used by real developers, solving real-world problems
  • Runs on the JVM, providing full interoperability with Java APIs
  • By Martin Odersky, author of the modern `javac` compiler

@metasim
metasim / sbt-jfx-frag.scala
Created September 10, 2013 17:33
Fragment for setting the JDK path for sbt-javafx plugin.
JFX.devKit := {
System.getProperty("os.name").toLowerCase match {
case w if w.startsWith("win") => JFX.jdk("C:/Program Files/Java/jdk1.7.0_25")
case _ => JFX.jdk(javaHome.value.toString)
}
}
@metasim
metasim / ScalaInterpreterExample.java
Last active November 6, 2017 10:02
Demo code for defining a scala class dynamically (as string) and load it into Java.
package eri;
import scala.collection.Iterator;
import scala.collection.JavaConversions;
import scala.collection.Seq;
import scala.reflect.internal.util.BatchSourceFile;
import scala.reflect.io.AbstractFile;
import scala.runtime.AbstractFunction1;
import scala.runtime.BoxedUnit;
import scala.tools.nsc.GenericRunnerSettings;
@metasim
metasim / repeat-until.scala
Created November 16, 2013 18:31
Example of creating a `repeat { ... } until (...)` like control structure.
import scala.annotation.tailrec
object controls {
def repeat(body: => Unit) = new {
@tailrec
def until(condition: => Boolean) {
body
if (condition) () else until(condition)
}