(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| /** | |
| * Takes a camel cased identifier name and returns an underscore separated | |
| * name | |
| * | |
| * Example: | |
| * camelToUnderscores("thisIsA1Test") == "this_is_a_1_test" | |
| */ | |
| def camelToUnderscores(name: String) = "[A-Z\\d]".r.replaceAllIn(name, {m => | |
| "_" + m.group(0).toLowerCase() | |
| }) |
| exports.handler = (event, context, callback) => { | |
| // WARNING : | |
| // This snippet assumes : event.Records[0].eventName == 'ObjectCreated:Put' | |
| // but the ful code deals with both 'ObjectCreated:Put' and 'ObjectRemoved:Delete' | |
| var filename = event.Records[0].s3.object.key; | |
| var bucketname = event.Records[0].s3.bucket.name; | |
| var params = { |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Picking the right architecture = Picking the right battles + Managing trade-offs
| [cloudera@quickstart build-target]$ klist | |
| Ticket cache: FILE:/tmp/krb5cc_501 | |
| Default principal: hdfs@CLOUDERA | |
| Valid starting Expires Service principal | |
| 08/30/15 05:15:22 08/31/15 05:15:22 krbtgt/CLOUDERA@CLOUDERA | |
| renew until 09/06/15 05:15:22 | |
| [cloudera@quickstart build-target]$ export HADOOP_CONF_DIR=/usr/lib/hadoop/etc/hadoop/ | |
| [cloudera@quickstart build-target]$ ./bin/yarn-session.sh -n 1 | |
| 05:15:37,483 INFO org.apache.hadoop.yarn.client.RMProxy - Connecting to ResourceManager at quickstart.cloudera/127.0.0.1:8032 |
| var AWS = require('aws-sdk'); | |
| exports.handler = function(event, context) { | |
| var cloudsearchdomain = new AWS.CloudSearchDomain({endpoint: 'doc-dev-cinch-accounts-ltmqj5gt5mjb5hg5eyqaf2v5hu.us-east-1.cloudsearch.amazonaws.com'}); | |
| var documents = event.Records.map(function(record) { | |
| var data = {id : record.dynamodb.Keys.id.S}; | |
| if (record.eventName === 'REMOVE') { | |
| data.type = 'delete' |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| import java.security.*; | |
| public class Sha { | |
| public static String hash256(String data) throws NoSuchAlgorithmException { | |
| MessageDigest md = MessageDigest.getInstance("SHA-256"); | |
| md.update(data.getBytes()); | |
| return bytesToHex(md.digest()); | |
| } | |
| public static String bytesToHex(byte[] bytes) { | |
| StringBuffer result = new StringBuffer(); | |
| for (byte byt : bytes) result.append(Integer.toString((byt & 0xff) + 0x100, 16).substring(1)); |
| require 'benchmark' | |
| require 'rubygems' | |
| require 'json' | |
| require 'yaml' | |
| include Benchmark | |
| benchmark_iterations = 1 | |
| large_single_dimension_array = [42, 123.123] * 5000 | |
| large_single_dimension_hash = {} | |
| 10000.times do |i| |