Haskell example:
powerset :: (Eq t) => [t] -> [[t]]
powerset [ ] = []
powerset [ h ] = [ [h] ]
powerset (h:t) = map (h:) sub ++ sub
where sub = powerset t| #!/bin/bash | |
| set -o errexit -o nounset -o pipefail | |
| function -h { | |
| cat <<EOF | |
| USAGE: syslogged <program> <args> | |
| Wraps a command invocation with logging, sending STDOUT and STDERR to | |
| syslog, setting the syslog tag to: | |
| <program>[<pid>] |
| import scala.concurrent._ | |
| import scala.concurrent.duration._ | |
| import java.util.concurrent.Executors.newFixedThreadPool | |
| val logger = java.util.logging.Logger.getLogger("par") | |
| def f(n: Int): Int = { | |
| Thread.sleep(20000) | |
| logger.info(f"$n%04d") | |
| n*2 | |
| } |
| function ips { | |
| /sbin/ifconfig | tr '\t' ' ' | # OS X gives us tabs, remove them | |
| sed -n '/^ *inet / { s/// ; p ;}' | # Only IPv4, thanks | |
| cut -d' ' -f1 | # Throw away everything but the addr | |
| sed s/addr:// | # Strip addr: prefix on Linux | |
| fgrep -v 127.0.0.1 # We already know about this one | |
| } |
| import org.kamranzafar.jtar._ | |
| import java.io.{ByteArrayInputStream, ByteArrayOutputStream} | |
| import scala.collection.mutable.ArrayBuffer | |
| import com.google.common.base.Charsets | |
| object Tar { | |
| def toTar(entries: Map[String,String]): Array[Byte] = { | |
| val bytesOut = new ByteArrayOutputStream() | |
| val archive = new TarOutputStream(bytesOut) | |
| val mTime: Long = System.currentTimeMillis() / 1000 |
Haskell example:
powerset :: (Eq t) => [t] -> [[t]]
powerset [ ] = []
powerset [ h ] = [ [h] ]
powerset (h:t) = map (h:) sub ++ sub
where sub = powerset t| bash -c '[[ ${1+isset} ]] ; echo "#? $?" ; echo "#1 $1"' bash | |
| #? 1 | |
| #1 | |
| bash -c '[[ ${1+isset} ]] ; echo "#? $?" ; echo "#1 $1"' bash x | |
| #? 0 | |
| #1 x |
| #!/bin/bash | |
| set -o errexit -o nounset -o pipefail | |
| function -h { | |
| cat <<USAGE | |
| USAGE: ln_libjvm.bash | |
| Symlink a likely libjvm.so into /usr/bin. | |
| USAGE | |
| }; function --help { -h ;} |
| while :; do sleep 1; done <IN >OUT | |
| sed s/^/::/ >IN <OUT | |
| cat IN | |
| echo x > OUT |
| function check_path_for_usr_local_bin { | |
| printf %s "$PATH" | while read -d: -r line | |
| do printf '%s\n' "$line" | |
| done | fgrep -qx /usr/local/bin | |
| } |
| I1217 19:23:11.844920 2201 state.cpp:33] Recovering state from '/tmp/mesos/meta' | |
| Incompatible slave info detected. | |
| ------------------------------------------------------------ | |
| Old slave info: | |
| hostname: "ip-10-46-210-228.ec2.internal" | |
| webui_hostname: "ip-10-46-210-228.ec2.internal" | |
| resources { | |
| name: "cpus" | |
| type: SCALAR | |
| scalar { |