Skip to content

Instantly share code, notes, and snippets.

@rei999
rei999 / gist:4577462
Created January 20, 2013 09:26
sample layout.vm decorator for SiteMesh
<html>
<head>
<title>$title</title>
<link href="$base/stylesheets/style.css" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
$head
</head>
<body>
<div id="pageTitle">The title: $title</div>
<hr/>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
default-lazy-init="true">
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost/mytestdatabase?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8&autoReconnect=true
jdbc.username=root
jdbc.password=root
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
# Needed by Hibernate3 Maven Plugin defined in pom.xml
hibernate.connection.username=root
hibernate.connection.password=root
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mycompany</groupId>
<artifactId>myproject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.mycompany.package2</groupId>
@rei999
rei999 / map.java
Created July 10, 2013 00:59
example hadoop mapper
package com.mycompany.emr;
import java.io.IOException;
import java.util.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
import com.mycompany.emr.EmployeeRecord;
@rei999
rei999 / reduce.java
Created July 10, 2013 01:00
example hadoop reducer
package com.mycompany.emr;
import java.io.IOException;
import java.util.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
public class Reduce extends Reducer<Text, IntWritable, Text, IntWritable> {
@rei999
rei999 / EmployeeRecord.java
Created July 10, 2013 01:02
example serializable entity record for hadoop
package com.mycompany.emr.model;
import java.sql.*;
import java.io.*;
import java.sql.ResultSet;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapreduce.lib.db.DBWritable;
public class EmployeeRecord implements Writable, DBWritable {
@rei999
rei999 / main.java
Created July 10, 2013 01:09
example hadoop
package com.mycompany.emr;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.mapreduce.lib.db.DBConfiguration;
import org.apache.hadoop.mapreduce.lib.db.DBInputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
@rei999
rei999 / launch.yml
Last active December 19, 2015 20:49
ansible - launch a ec2 instance
- name: create instances
hosts: localhost
vars:
keypair: myKeyPair
security_group: mySecurityGroup
instance_type: t1.micro
image: ami-05355a6c
count: 1
region: us-east-1
user: ec2-user
@rei999
rei999 / configure.yml
Created July 16, 2013 22:52
ansible - install php, mysql, nginx
- name: configure instances
hosts: webservers
user: ec2-user
sudo: yes
tasks:
- name: update machine with latest packages
action: command yum -y update
- name: install php
action: yum pkg=php state=latest
- name: install php-mysql