Skip to content

Instantly share code, notes, and snippets.

###修改ubuntu初始密码
#sudo passwd root
###修改主机名 
#/etc/hostname
#/etc/hosts
###安装ssh服务
#sudo apt-get install openssh-server
[root@Iven sysconfig]# cat iptables
# Generated by iptables-save v1.4.7 on Mon Jun 1 00:04:12 2015
*nat
:PREROUTING ACCEPT [49:4737]
:POSTROUTING ACCEPT [2:144]
:OUTPUT ACCEPT [2:144]
-A PREROUTING -p tcp -m tcp --dport 22222 -j REDIRECT --to-ports 22
COMMIT
# Completed on Mon Jun 1 00:04:12 2015
# Generated by iptables-save v1.4.7 on Mon Jun 1 00:04:12 2015
@doubledouble
doubledouble / gist:1803350
Created February 11, 2012 18:06
java_code
public class Test{
public String a = "hello";
}
@doubledouble
doubledouble / 做有意义的事
Created February 11, 2012 17:50
first begining
<h1>发觉自己的爱好!做有意义的事,倾听</h1>
/**
* see http://caterpillar.onlyfun.net/Gossip/DesignPattern/SingletonPattern.htm
* http://www.jackforfun.com/2007/07/java-synchronized.html
*/
public class Singleton {
private static Singleton instance = null;
private Singleton(){}
public static Singleton getInstance() {
if (instance == null){
synchronized(Singleton.class){
@doubledouble
doubledouble / 剪刀石头布
Created June 9, 2012 17:17
剪刀石头布
package test;
import java.util.Scanner;
public class ScissorStoneCloth {
/**
* @param args
*/
public static void main(String[] args) {
@doubledouble
doubledouble / java io.java
Last active October 6, 2015 05:28
java io
private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream fis = null;
FileOutputStream fos = null;
FileChannel input = null;
FileChannel output = null;
try {
@doubledouble
doubledouble / SingleInstance.java
Last active October 6, 2015 13:08
SingleInstance原来可以这么写
public class SingleInstance {
private static class InstanceHolder {
public static final SingleInstance instance = new SingleInstance();
}
public static SingleInstance getInstance() {
return InstanceHolder.instance;
}
}
public enum SingletonEnum {
/**
* 定义一个枚举的元素,它就代表了Singleton的一个实例。
*/
uniqueInstance;
/**
* 单例可以有自己的操作
*/
package com.iteye.common.test;
import junit.framework.TestCase;
import org.hibernate.FlushMode;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.hibernate3.SessionFactoryUtils;