This file contains hidden or 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 org.harbor; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.util.Arrays; | |
import java.util.List; | |
import javax.servlet.ServletException; | |
import javax.servlet.http.HttpServlet; |
This file contains hidden or 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 class HarborServlet extends HttpServlet { | |
private ScriptingContainer container; | |
private HttpServlet servlet; | |
@Override | |
public void init() { | |
String classpath = getServletContext().getRealPath("/WEB-INF/classes"); | |
List<String> loadPaths = Arrays.asList(classpath.split(File.pathSeparator)); | |
container = new ScriptingContainer(); |
This file contains hidden or 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
require "java" | |
hash_map = {} | |
java_import com.hazelcast.core.Hazelcast | |
at_exit { Hazelcast.shutdown_all } | |
hazel_map = Hazelcast.get_map "benchmark" | |
java_import org.infinispan.Cache | |
java_import org.infinispan.manager.DefaultCacheManager |
This file contains hidden or 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
# You can download the Xerces jar here: | |
# http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22xerces%22 | |
require "java" | |
require "xerces-2.4.0-sources.jar" | |
url = java.net.URL.new("http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=10/xml") | |
connection = url.open_connection | |
builder = javax.xml.parsers.DocumentBuilderFactory.new_instance.new_document_builder |
This file contains hidden or 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
A="example1" | |
B="example2" | |
SUM="0" | |
while read line; do | |
if [ -f "/nfs/$B/private/$line" ]; then | |
echo "PATH: $line already exists" | |
else | |
line_d="$(dirname "/nfs/$B/private/$line")" | |
if [ -d $line_d ]; then |
This file contains hidden or 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
if ! [ -d /Library/Java/JavaVirtualMachines/1.7.0u6.jdk ]; then | |
echo "Downloading OpenJDK 7" | |
curl -o /tmp/OpenJDK-7.dmg http://openjdk-osx-build.googlecode.com/files/OpenJDK-OSX-1.7-universal-u-jdk-jdk7u6-b10-20120522.dmg | |
echo "Attaching DMG image" | |
hdiutil attach /tmp/OpenJDK-7.dmg | |
echo "Copying JDK into available Java Virtual Machines" | |
sudo cp -R /Volumes/OpenJDK\ 7\ \(Mac\ OS:X\ Port\)/1.7.0u.jdk /Library/Java/JavaVirtualMachines/1.7.0u6.jdk | |
echo "Detach DMG image" | |
hdiutil detach /Volumes/OpenJDK\ 7\ \(Mac\ OS:X\ Port\) |
This file contains hidden or 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
<td> | |
<FormattedDate | |
id="search_item_expiration_date[]" | |
format="admin-long" | |
value=#rsrs.created_at /> | |
</td> |
This file contains hidden or 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
psql -h db.example -c <<"EOS" example_client_database | |
CREATE OR REPLACE FUNCTION delete_photo(uuid) RETURNS INTEGER AS $$ | |
DECLARE | |
updated_photos_count INTEGER; | |
updated_photo_translations_count INTEGER; | |
updated_channels_photos_count INTEGER; | |
BEGIN | |
DELETE FROM photos WHERE uuid = $1; | |
GET DIAGNOSTICS updated_photos_count = ROW_COUNT; | |
This file contains hidden or 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
require "java" | |
jars = File.join(File.dirname(__FILE__), "*.jar") | |
Dir[jars].each { |jar| require jar } | |
import org.apache.ftpserver.FtpServer | |
import org.apache.ftpserver.FtpServerFactory | |
import org.apache.ftpserver.listener.ListenerFactory | |
server_factory = FtpServerFactory.new |
This file contains hidden or 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
#!/usr/bin/env bash | |
SOURCE= | |
TARGET= | |
DATABASE= | |
TABLE= | |
function usage() { | |
cat <<"EOS" | |
USAGE: dbcompare -h source target database [ table ] |