apt-get update
# We want to make ensure to allow all established connections and on-going sessions through the firewall, otherwise, the firewall would block the current SSH session
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
# Then use the following rule to block incoming port 22 (SSH)
iptables -A INPUT -p tcp --destination-port 22 -j DROP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
time docker run --rm -v $(pwd):/src mkenney/npm npm install | |
12:04:14 real 3m33.500s | |
12:04:14 user 0m0.780s | |
12:04:14 sys 0m0.716s | |
time docker run --rm -v $(pwd):/workspace kkarczmarczyk/node-yarn yarn install | |
12:07:29 real 2m0.769s | |
12:07:29 user 0m0.164s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::iter::FromIterator; | |
trait ExtendedIterator: Iterator { | |
fn tail<B>(&mut self) -> B where B:FromIterator<Self::Item>, Self::Item: Eq + Clone, Self: Sized{ | |
self.skip(1).collect::<B>() | |
} | |
} | |
impl<I> ExtendedIterator for I where I: Iterator {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -Ls http://bit.ly/2cTytMP|jq -r '.[].uuid'| xargs -I{} -n1 echo "http://cfp.scala.io/api/conferences/ScalaIOFR2016/speakers/{}"| xargs curl -s {}| jq -r '.acceptedTalks[].title' |
Using Give a try and bench ScyllaDB (Cassandra-compatible C++ db, 10x faster) with two lines of docker
Setup:
- ScyllaDb 1.0.3
- Docker version 1.9.1-cs2, build 4ade326
- Dedibox XC SSD 2016
- 1x Intel® C2750 (Avoton) - 8 C / 8T @2.4 Ghz x64, VT-x, AES-NI
- 16 GB DDR3
- 250 GB SSD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type, total ops, op/s, pk/s, row/s, mean, med, .95, .99, .999, max, time, stderr, errors, gc: #, max ms, sum ms, sdv ms, mb | |
total, 3691, 3691, 3691, 3691, 1.1, 0.7, 4.3, 8.5, 12.1, 14.2, 1.0, 0.00000, 0, 0, 0, 0, 0, 0 | |
total, 8360, 4599, 4599, 4599, 0.9, 0.4, 3.3, 9.2, 15.1, 18.8, 2.0, 0.07740, 0, 0, 0, 0, 0, 0 | |
total, 15809, 7387, 7387, 7387, 0.5, 0.3, 1.2, 6.5, 16.1, 23.9, 3.0, 0.17373, 0, 0, 0, 0, 0, 0 | |
total, 26494, 10567, 10567, 10567, 0.4, 0.3, 0.7, 1.2, 10.4, 14.3, 4.0, 0.20454, 0, 0, 0, 0, 0, 0 | |
total, 37227, 10631, 10631, 10631, 0.4, 0.3, 0.8, 1.2, 7.0, 10.2, 5.0, 0.17680, 0, 0, 0, 0, 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start in one terminal scylla | |
docker run --rm -P -i -t --name=scylla scylladb/scylla | |
# start in another terminal cassandra-stress test | |
docker run --link scylla -it --rm joprice/scylla-tools cassandra-stress write -mode cql3 native -node $(docker inspect -f '{{ .NetworkSettings.IPAddress }}' scylla) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tested with docker-machine on MacOSX | |
# start zookeeper | |
docker run -d --rm -it -p 2181:2181 digitalwonderland/zookeeper | |
# start kafka | |
docker run -d --rm -it -p 9000:9000 -e ZK_HOSTS="`docker-machine ip default`:2181" -e APPLICATION_SECRET=letmein sheepkiller/kafka-manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print[A](params:A*) = params.foreach(println) | |
// Below, every call to our print function are equivalent | |
// apply an array of arguments | |
val params = Seq(1,2,3) | |
print(params: _*) | |
// apply an array of arguments | |
print(Seq(1,2,3): _*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import Keys._ | |
import play.Project._ | |
object ApplicationBuild extends Build { | |
System.setProperty("http.port", "9001") | |
// this setting can be overriden with `play "run 9002"` | |
// ... | |
} |