Skip to content

Instantly share code, notes, and snippets.

View piyasde's full-sized avatar

Piyas De piyasde

View GitHub Profile
@piyasde
piyasde / es6 Fat Arrow Functions in Browser (Currently supported in Firefox)
Last active August 29, 2015 14:21
es6 Fat Arrow Functions in Browser (Currently supported in Firefox)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id ="resultLen"></div>
<div id ="resultSearch"></div>
</body>
<script>
@piyasde
piyasde / es6 Fat Arrow function in Server Side
Last active August 29, 2015 14:21
es6 Fat Arrow function in Server Side
var a = [
"Hydrogen",
"Helium",
"Lithium",
"Beryl­lium"
];
var a2 = function(s){ return s.length };
var a3 = ((s) => s.length);
@piyasde
piyasde / Sample java client for Apache Kafka Producer
Created May 14, 2015 04:55
Sample java client for Apache Kafka Producer
package com.apt.server;
import kafka.producer.KeyedMessage;
import kafka.producer.ProducerConfig;
import java.util.Properties;
@piyasde
piyasde / Hadoop 2.6.0 Multi Node Installation and Test Run in Ubuntu 14.04
Created March 19, 2015 05:14
Hadoop 2.6.0 Multi Node Installation and Test Run in Ubuntu 14.04
1. You can follow https://gist.github.com/piyasde/17d4f7bc97c0f0820d40 for single node setup for all the machines in cluster
2. Make a user group for Hadoop Users
3. Make same user for hadoop in all the machines where the hadoop setup will be done
4. Select a machine which will be master node.
On that machine vi /etc/hosts and add the ip a name as master not localhost.
vi /etc/hosts
#127.0.0.1 localhost
#127.0.1.1 ubupc1
@piyasde
piyasde / Hadoop 2.6.0 Single Node Installation and Test Run in Ubuntu 14.04
Last active August 29, 2015 14:17
Hadoop 2.6.0 Single Node Installation and Test Run in Ubuntu 14.04
Step 0 -
Update your machine with -
$ sudo apt-get install ssh
$ sudo apt-get install rsync
###Machine 1(master).
Pre-requisite:
@piyasde
piyasde / nginx.conf
Created January 4, 2015 05:48
Nginx and node.js server integration
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@piyasde
piyasde / HibernateUtil.java
Last active June 13, 2019 10:05
Multitenancy in Hibernate (with Hibernate 4.3.7 and PostgreSql 9.3.1)
package com.mt;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
@piyasde
piyasde / expressjs.features
Created June 23, 2014 02:35
New features in express.js
var express = require('express');
var morgan = require('morgan');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var app = express();
app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users
app.use(morgan('dev')); // log every request to the console
app.use(bodyParser()); // pull information from html in POST
app.use(methodOverride()); // simulate DELETE and PUT