Skip to content

Instantly share code, notes, and snippets.

app = Dragonfly[:images]
app.configure_with(:imagemagick)
app.analyser.add :average_intensity do |temp_object|
(`python lib/simple_analyser.py #{temp_object.path}`.gsub("\n","").strip.to_f rescue 0.0)
end
app.processor.add :first_frame_of_gif_as_png do |temp_object|
tempfile = Tempfile.new(['dragonfly','.png'])
tempfile.binmode
tempfile.close
`convert #{temp_object.path}[0] #{tempfile.path}`
Program received signal SIGABRT, Aborted.
0x00007fffedcac425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 0x00007fffedcac425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007fffedcafb8b in __GI_abort () at abort.c:91
#2 0x00007fffee81c69d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007fffee81a846 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007fffee81a873 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007fffee81a96e in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
// Consumer
ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerZipfMandelbrot");
// Consumer will request /prefix0, /prefix1, ...
consumerHelper.SetPrefix("/producer");
//consumerHelper.SetProducerPrefix ("/producer");
consumerHelper.SetAttribute ("Frequency", StringValue ("10")); // 10 interests a second
consumerHelper.SetAttribute("Randomize", StringValue ("uniform"));
//consumerHelper.SetAttribute("producerprefix", StringValue("/producer"));
consumerHelper.SetAttribute("NumberOfContents", StringValue("9"));

WAL-E needs to be installed on all machines, masters and slaves.

How to install WAL-E

Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:

archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
Inside Main josh
sending dcnet protocol start message by master node 4with message Start DCNET protocol among nodes-10.1.1.1:0,10.1.1.2:1,10.1.1.3:2,10.1.1.4:3,10.1.1.5:4,10.1.1.6:5,10.1.1.7:6,10.1.1.8:7,10.1.1.9:8,10.1.1.10:9,10.1.1.11:10,10.1.1.12:11,10.1.1.13:12,10.1.1.14:13,10.1.1.15:14,10.1.1.16:15,10.1.1.17:16,10.1.1.18:17,10.1.1.19:18,10.1.1.20:19,10.1.1.21:20,10.1.1.22:21,10.1.1.23:22,10.1.1.24:23,10.1.1.25:24,10.1.1.26:25,10.1.1.27:26,10.1.1.28:27,10.1.1.29:28
Generating coin flips for node20
Generating coin flips for node3
Generating coin flips for node6
Generating coin flips for node2
Generating coin flips for node26
Generating coin flips for node7
Generating coin flips for node5
Generating coin flips for node21
# these make the ec2 commands just work
export AWS_ACCESS_KEY=[AWS access key]
export AWS_SECRET_KEY=[AWS secret]
# fetch the instance id
export INSTANCE_ID=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)
#grep out the tag you're looking for, in this case "Name"
export APP_TAG=$(ec2-describe-tags | grep $INSTANCE_ID | grep -oE "Name\\W+(.+)$" | grep -oE "\\W.+$")
@joshjdevl
joshjdevl / gist:26ddf5f5e8d9e495c87b
Last active August 29, 2015 14:02 — forked from shawnburke/gist:3750709
ubuntu ec2 bash prompt instance tag name
# these make the ec2 commands just work
export AWS_ACCESS_KEY=[AWS access key]
export AWS_SECRET_KEY=[AWS secret]
# fetch the instance id
export INSTANCE_ID=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)
#grep out the tag you're looking for, in this case "Name"
export APP_TAG=$(ec2dtag --region us-west-2 --filter "key=Name" --filter "resource-type=instance" --filter "resource-id=$INSTANCE_ID" | grep -oE "Name\\W+(.+)$" | grep -oE "\\W.+$")
@joshjdevl
joshjdevl / gist:b9af68b11398fd1823c4
Created November 4, 2014 21:10
spark sortby compile error
case class Person(first: String, last: String, age: Int)
val parse = (s: String) => {
val split = s.split("\\|")
Person(split(0), split(1), split(2).toInt)
}
object AgeOrdering extends Ordering[Person] {
def compare(a:Person, b:Person) = a.age compare b.age
}
@joshjdevl
joshjdevl / sodium
Created January 3, 2015 15:48
sodium
/* example.i */
%module SodiumJni
%include "typemaps.i"
%include "stdint.i"
%include "arrays_java.i"
%include "carrays.i"
%include "various.i"
%apply int {unsigned long long};
echo "0.0.0.0 master" >> /etc/hosts
echo "192.168.59.103 zk" >> /etc/hosts
echo "192.168.59.103 postgres" >> /etc/hosts
cd /usr/local/spark
./sbin/start-master.sh
cd /usr/local/spark
./bin/spark-class org.apache.spark.deploy.worker.Worker spark://IP:PORT