Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Matthew King

« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS 

mzscheme 352 Portfile (to get Arc working on OS X)

# $Id$

PortSystem 1.0

name mzscheme
version 352
categories lang scheme
platforms darwin
maintainers nomaintainer
description MzScheme is an implementation of the Scheme programming language
long_description ${description}

homepage http://www.plt-scheme.org/software/mzscheme/
set subdir ${version}/mz/
master_sites \
http://download.plt-scheme.org/bundles/${subdir} \
http://plt.cs.uchicago.edu/bundles/${subdir} \
http://www.cs.utah.edu/plt/download/${subdir} \
ftp://archive.informatik.uni-tuebingen.de/unix/language/plt/${subdir} \
ftp://infogroep.be/pub/plt/bundles/${subdir} \
http://gd.tuwien.ac.at/languages/scheme/plt/${subdir}
distfiles mz-${version}-src-unix.tgz
checksums md5 218bad0defbdbb72d94d8a3fb4fa6545

depends_lib port:jpeg \
port:libpng \
port:libiconv

worksrcdir plt/src

post-patch {
reinplace "s|collects|share/mzscheme|g" \
${worksrcpath}/mzscheme/src/startup.ss \
${worksrcpath}/mzscheme/src/startup.inc
reinplace "s|~/Library/PLT Scheme/|${prefix}/share/mzscheme/|g" \
${worksrcpath}/mzscheme/src/file.c
}

configure.env CFLAGS="-I${prefix}/include" \
CPPFLAGS="-I${prefix}/include" \
LDFLAGS="-L${prefix}/lib"

destroot.destdir prefix=${destroot}${prefix}
post-destroot {
file delete -force ${destroot}${prefix}/install \
${destroot}${prefix}/share/man
file rename ${destroot}${prefix}/collects \
${destroot}${prefix}/share/mzscheme
xinstall -m 755 -d ${destroot}${prefix}/share/doc/ \
${destroot}${prefix}/share/mzscheme/${version}/
system "cd ${destroot}${prefix}/share/mzscheme/${version} && ln -s .. collects"
file rename ${destroot}${prefix}/man \
${destroot}${prefix}/share/man
file rename ${destroot}${prefix}/doc \
${destroot}${prefix}/share/doc/mzscheme
file delete -force ${destroot}${prefix}/lib/buildinfo
}

Generate WEP hex key from plaintext

# pad the plaintext to 64 characters, then get an MD5 digest
# 128 bits, duh.

require 'digest/md5'

def pad(text)
v = text * (1 + (64 / text.length))
v[0,64]
end

def wep_key(text)
Digest::MD5.hexdigest(pad(text))
end


Environment-specific configuration in Merb

// this goes at the bottom of dist/conf/merb_init.rb

case Merb::Server.config[:environment]
when 'development'
  # do some stuff
when 'production'
  # do other stuff
end

Mac OS X launchd plist to run PHP fcgi

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version='1.0'>
	<dict>
	<key>Label</key><string>com.automatthew.php</string>
	<key>ProgramArguments</key>
	<array>
	        <string>/opt/php/bin/php</string>
	        <string>-b 127.0.0.1:9000</string>
	        <string>-q</string>
	</array>
	<key>EnvironmentVariables</key>
	<dict>
	        <key>PHP_FCGI_CHILDREN</key>
	        <string>4</string>
	</dict>
	<key>Debug</key><false/>
	<key>Disabled</key><false/>
	<key>OnDemand</key><false/>
	<key>RunAtLoad</key><false/>
</dict>
</plist>
« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS