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
#!/bin/bash | |
DIRECTORY=$1 | |
CLASS_NAME=$2 | |
find $DIRECTORY -name '*.[jwes]ar' | while read LINE; do | |
grep -q $CLASS_NAME "$LINE"; | |
if [ $? -eq 0 ]; then | |
REFERENCES=$(jar tvf "$LINE" | grep $CLASS_NAME); | |
if [ -n "$REFERENCES" ]; then | |
echo "$LINE"; | |
echo "$REFERENCES"; |
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 org.apache.catalina.Context; | |
import org.apache.catalina.Engine; | |
import org.apache.catalina.Host; | |
import org.apache.catalina.LifecycleException; | |
import org.apache.catalina.connector.Connector; | |
import org.apache.catalina.startup.Embedded; | |
import java.io.File; | |
/** |
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
/* | |
* Copyright 2011 Stanley Shyiko | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
#!/bin/bash | |
JDGUI_BIN=$1; FILE_PATH=$2 | |
DELIMITER_INDEX=$(awk -v a="$FILE_PATH" -v b="!/" 'BEGIN{print index(a,b)}') | |
if [ $DELIMITER_INDEX -eq 0 ]; then | |
$JDGUI_BIN $FILE_PATH | |
else | |
JAR_FILE=${FILE_PATH:0:$DELIMITER_INDEX-1} | |
CLASS_RELATIVE_LOCATION=${FILE_PATH:$DELIMITER_INDEX+1} | |
if [[ $CLASS_RELATIVE_LOCATION == "" ]]; then | |
$JDGUI_BIN $JAR_FILE |
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 org.apache.hadoop.conf.Configuration; | |
import org.apache.hadoop.fs.FileSystem; | |
import org.apache.hadoop.fs.Path; | |
import org.apache.hadoop.io.SequenceFile; | |
import org.apache.hadoop.io.Writable; | |
import java.io.IOException; | |
import java.lang.reflect.ParameterizedType; | |
import java.lang.reflect.Type; | |
import java.util.List; |
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
<tableid> = select oid from pg_class where relname = '<tablename>'; | |
<rowid> = select id from ( | |
select rr.id from <tablename> rr left join pg_locks pgl | |
on pgl.classid = <tableid> and pgl.objid = rr.id | |
where pgl.objid is null limit 1 | |
) iq where pg_try_advisory_lock(<tableid>, id); | |
-- select * from pg_locks where locktype = 'advisory'; | |
select pg_advisory_unlock(<tableid>, <rowid>); |
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 class Cache<K, V> { | |
private final Map<K, SoftReference<V>> map; | |
public Cache(final int cacheSize) { | |
map = Collections.synchronizedMap(new LinkedHashMap<K, SoftReference<V>>() { | |
@Override | |
protected boolean removeEldestEntry(java.util.Map.Entry<K, SoftReference<V>> eldest) { | |
return size() > cacheSize; |
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
<project ...> | |
... | |
<properties> | |
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin> | |
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> | |
<sonar.jacoco.reportPath>${user.dir}/target/jacoco.exec</sonar.jacoco.reportPath> | |
</properties> | |
... | |
<build> | |
<plugins> |
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
#!/bin/bash | |
mvn $* | |
if [ $? -gt 0 ] | |
then | |
notify-send -i /usr/share/icons/Humanity/status/64/dialog-warning.svg "Maven" "Build failed." | |
else | |
notify-send -i /usr/share/icons/Humanity/actions/64/gtk-info.svg "Maven" "Build succeeded." | |
fi |
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
/** | |
* Provides method-invocation-scope variables. | |
* <p/> | |
* Each invocation of {@link #get()} within same method (including nested calls) will yield value previously set by | |
* {@link #set(Object)}. Once {@link #set(Object)} region ends, value is rolled back to the default one (provided | |
* during {@link InvocationLocal} instance construction). | |
* <p/> | |
* Implementation is thread-safe. | |
* | |
* @author <a href="mailto:[email protected]">sshyiko</a> |
OlderNewer