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 java.nio.channels.* | |
def truncFile(File file, long newSize) { | |
FileChannel fileChannel; | |
try { | |
fileChannel = new FileOutputStream(file, true).getChannel(); | |
fileChannel.truncate(newSize); | |
} finally { | |
fileChannel?.close() | |
} |
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
@GrabConfig(systemClassLoader=true) | |
@Grab('org.slf4j:slf4j-simple:1.7.1') | |
@Grab('org.quartz-scheduler:quartz:2.1.6') | |
import org.quartz.* | |
import org.quartz.impl.* | |
import org.quartz.jobs.* | |
config = args.length > 0 ? args[0] : 'quartz.properties' | |
scheduler = new StdSchedulerFactory(config).getScheduler() | |
scheduler.start() |
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
@echo off | |
set DOT_NET_HOME=C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319 | |
set PATH=%PATH%;%DOT_NET_HOME% |
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
-XX:MaxJavaStackTraceDepth=1000000 |
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
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048 | |
- OR - | |
# generate an RSA keypair | |
keytool -genkey -alias selfsigned -keystore keystore.jks | |
# The next step in self-signing is to create a digital certificate | |
keytool -selfcert -keystore keystore.jks -alias selfsigned -storepass password |
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
package utils; | |
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.ObjectInputStream; | |
import java.io.ObjectOutputStream; | |
import java.io.Serializable; | |
public class CloneUtils { |
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
public interface EntityReader<Type> { | |
List<Type> list() throws DAOException; | |
Type uniqueResult() throws DAOException; | |
} | |
import java.sql.ResultSet; | |
import java.sql.SQLException; |
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 [master] | |
GO | |
ALTER LOGIN [sa] WITH PASSWORD=N'password' | |
GO | |
ALTER LOGIN [sa] ENABLE | |
GO |
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 java.text.* | |
Date.metaClass.'static'.fromString = { str -> | |
// Wed Jan 30 18:26:11 CET 2013 | |
SimpleDateFormat parser = new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy", Locale.US) | |
parser.parse(str) | |
} |
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
// log.debug("Returning user ids: {}", collect(users, "id")); | |
public static Collection collect(Collection collection, String propertyName) { | |
return CollectionUtils.collect(collection, new BeanToPropertyValueTransformer(propertyName)); | |
} |