(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() | |
| }) |
| /** | |
| * 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() | |
| }) |
| #!/usr/bin/env python | |
| from __future__ import print_function | |
| import base64 | |
| import sys | |
| PEM = ("""-----BEGIN RSA PRIVATE KEY----- | |
| MIIEogIBAAKCAQEAgK1Q6Ydi8UUheJLvnTYJE65NOZtAtjDdDSxS+6b4x9EakjIylljSzs5uLEJn |
| package main | |
| import ( | |
| "github.com/gin-gonic/gin" | |
| "github.com/jinzhu/gorm" | |
| _ "github.com/mattn/go-sqlite3" | |
| ) | |
| type Users struct { | |
| Id int `gorm:"AUTO_INCREMENT" form:"id" json:"id"` |
(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.
| # Wes Floyd April 2015 | |
| import sys | |
| import requests | |
| import json | |
| import argparse | |
| import pprint | |
| import time | |
| pp = pprint.PrettyPrinter(indent=4) |
#Kafka - Messaging Basics This assumes you are starting fresh and have no existing Kafka or ZooKeeper data. See http://kafka.apache.org/documentation.html#quickstart for more details.
##Install Java
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
| kawasaki@hadoop11:~$ hdfs cacheadmin -listDirectives | |
| Found 0 entries | |
| kawasaki@hadoop11:~$ hdfs cacheadmin -listDirectives stats | |
| Can't understand argument: stats | |
| kawasaki@hadoop11:~$ hdfs cacheadmin -listDirectives -stats | |
| Found 0 entries | |
| kawasaki@hadoop11:~$ hadoop fs -ls dir1 | |
| Found 4 items | |
| drwxr-xr-x - kawasaki kawasaki 0 2014-04-09 06:38 dir1/a | |
| -rw-r--r-- 3 kawasaki kawasaki 75288655 2014-04-09 06:44 dir1/bigfile |
| Producer | |
| Setup | |
| bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1 | |
| bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3 | |
| Single thread, no replication | |
| bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196 |
| $ kafka-topics --zookeeper localhost:2181 --create --topic test-rep-one -partitions 6 --replication-factor 1 | |
| Created topic "test-rep-one". | |
| kafka-producer-perf-test --topic test-rep-one --num-records 50000 --record-size 1000 --throughput 1000 --producer-props acks=-1 bootstrap.servers=$HOSTNAME:9092 | |
| 5000 records sent, 1000.0 records/sec (0.95 MB/sec), 4.3 ms avg latency, 222.0 max latency. | |
| 5005 records sent, 1000.8 records/sec (0.95 MB/sec), 1.6 ms avg latency, 10.0 max latency. | |
| 5002 records sent, 1000.2 records/sec (0.95 MB/sec), 1.4 ms avg latency, 23.0 max latency. | |
| 5002 records sent, 1000.2 records/sec (0.95 MB/sec), 1.3 ms avg latency, 8.0 max latency. | |
| 5001 records sent, 1000.2 records/sec (0.95 MB/sec), 1.2 ms avg latency, 6.0 max latency. | |
| 5000 records sent, 1000.0 records/sec (0.95 MB/sec), 1.2 ms avg latency, 5.0 max latency. |