Skip to content

Instantly share code, notes, and snippets.

View rahulkumar-aws's full-sized avatar

Rahul Kumar rahulkumar-aws

View GitHub Profile
@rahulkumar-aws
rahulkumar-aws / Docker_work.md
Last active July 2, 2018 21:12
Docker work

docker pull mongo mkdir ~/data sudo docker run -d -p 27017:27017 -v ~/data:/data/db mongo docker exec -it some-mongo bash docker logs some-mongo

docker pull mysql

docker run \

@rahulkumar-aws
rahulkumar-aws / HadoopSingleNode.md
Last active June 21, 2018 17:13
Hadoop Installation Single Node

Set JAVA_HOME

$ vim .bash_profile 
export JAVA_HOME=$(/usr/libexec/java_home)
$ source .bash_profile
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home

Setup Password less ssh

@rahulkumar-aws
rahulkumar-aws / Ubuntu16.04-package-setup
Created June 7, 2018 18:55
Sample Ubuntu packages setup
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
## Java8
sudo apt-get install oracle-java8-installer
## Managing Java
sudo update-alternatives --config java
## Setting the JAVA_HOME Environment Variable
sudo nano /etc/environment
In your Play application, you can use ReactiveMongo with multiple connection pools (possibly with different replica sets and/or different options), using the @NamedDatabase annotation.
Consider the following configuration, with several connection URIs.
# The default URI
mongodb.uri = "mongodb://someuser:somepasswd@localhost:27017/foo"
# Another one, named with 'bar'
mongodb.bar.uri = "mongodb://someuser:somepasswd@localhost:27017/lorem"
Then the dependency injection can select the API instances using the names.
@rahulkumar-aws
rahulkumar-aws / ReadCSV Java 8
Created December 17, 2017 13:27
Java 8 Read csv file
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ReadCSV {
var hexcase = 0;
var b64pad = "";
var chrsz = 8;
function hex_md5(A) {
return binl2hex(core_md5(str2binl(A), A.length * chrsz))
}
function b64_md5(A) {
return binl2b64(core_md5(str2binl(A), A.length * chrsz))
}
function str_md5(A) {
{"help": "https://catalog.data.gov/api/3/action/help_show?name=package_search", "success": true, "result": {"count": 48, "sort": "views_recent desc", "facets": {}, "results": [{"license_title": "License not specified", "maintainer": "New Media", "relationships_as_object": [], "private": false, "maintainer_email": "[email protected]", "num_tags": 5, "id": "59694770-b6b6-4ae0-a4b9-4ae69c0be2f6", "metadata_created": "2016-07-02T10:06:26.199575", "metadata_modified": "2016-07-02T10:06:26.199575", "author": null, "author_email": null, "state": "active", "version": null, "creator_user_id": "47303a9e-1187-4290-85a3-1fc02dc49e4a", "type": "dataset", "resources": [{"cache_last_updated": null, "package_id": "59694770-b6b6-4ae0-a4b9-4ae69c0be2f6", "webstore_last_updated": null, "id": "3a8a0ad1-19e7-4153-bb2f-d70cf88aaaf8", "size": null, "state": "active", "hash": "", "description": "", "format": "CSV", "tracking_summary": {"total": 32, "recent": 1}, "last_modified": null, "url_type": null, "no_real_name": "True",
@rahulkumar-aws
rahulkumar-aws / CorsSupport.scala
Last active September 21, 2015 22:27 — forked from joseraya/CorsSupport.scala
CORS directive for Spray
package com.agilogy.spray.cors
import spray.http.{HttpMethods, HttpMethod, HttpResponse, AllOrigins}
import spray.http.HttpHeaders._
import spray.http.HttpMethods._
import spray.routing._
// see also https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
trait CORSSupport {
this: HttpService =>
@rahulkumar-aws
rahulkumar-aws / gist:2ac98e913941295f7191
Created September 21, 2015 09:19
Javascript flatMap implementation
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
Example
[0, 1, 2, 3, 4, 5].flatMap(function(x) {
return [x, x + 1];
});
1) install boost
brew install boost
it will ask to create link. just follow the instruction
2) install libevent
brew install libevent