Skip to content

Instantly share code, notes, and snippets.

View brianduff's full-sized avatar

Brian Duff brianduff

View GitHub Profile
@brianduff
brianduff / TestClass.java
Created December 28, 2019 20:15
Java 1.5 Features
import java.util.*;
public class TestClass
{
public static void main( String[] args )
{
List<String> words = new ArrayList<String>();
words.add( "This" );
words.add( " is" );
words.add( " cool :)" );
@brianduff
brianduff / oracle
Created December 28, 2019 22:21
Ancient script to start / stop oracle on gentoo
#!/sbin/runscript
#
# name: /etc/init.d/oracle
# description: starts and stops Oracle on Gentoo Linux
# author: Brian.Duff@oracle.com
#
# Change this to your Oracle user
oracle_user=ora92
filenames
.parallelStream()
.forEach(f -> writeFile(tempDirWithPrefix.resolve(f), data));
moduleDeps.keySet().stream()
.filter(dep -> dep instanceof IjLibrary)
.map(library -> (IjLibrary) library)
.forEach(referencedLibraries::add);
for (IjProjectElement dep : moduleDeps.keySet()) {
if (dep instanceof IjLibrary) {
referencedLibraries.add((IjLibrary) dep);
}
}
type RecordIndex = i32;
type ContentIndex = i32;
type Bytes = Vec<u8>;
/// IJ has the notion of "enumerations" which are basically fast bimaps between a value of
/// arbitrary type and an integer, and support automatically adding new values which
/// get an auto-incremented integer value.
type Enumeration<A> = BiMap<A, i32>;
public void doSomethingInteresting(Thingy t) {
if (Config.shoudLogInterestingThings()) {
LOG.info("doSomethingInteresting(%s)", t);
}
// Actually do something interesting
}
package frodo;
public class Example {
public static void main(String[] args) {
new Test().run();
}
public void run() {
System.out.println(someMethod(new RealFile("/foo")));
System.out.println(someMethod(new RealFile("/bar")));
# This is the class I care about
- frodo/Test
# And this is a method I want to log with its super ugly JVM signature
- someMethod(Lfrodo/Test$RealFile;)Ljava/lang/String;
# Please show me an abbreviated stack trace for each call
- showTrace: true
# And use the getPath() method to convert the parameter to a String
- displayMethod: getPath
someMethod: /foo
trace: <- someMethod <- run <- main
someMethod: /bar
trace: <- someMethod <- run <- main