Skip to content

Instantly share code, notes, and snippets.

@wytten
wytten / ExecutorMonitor.java
Created May 22, 2013 17:37
This is an inner class created in response to ScheduledExecutorService silently stopping when a task throws an Exception. See http://stackoverflow.com/questions/6894595/scheduledexecutorservice-exception-handling
private class ExecutorMonitor extends Thread {
public ExecutorMonitor() {
super("ExecutorMonitor");
}
@Override
public void run() {
while (enableAll || enabled) {
LOG.info("Starting scheduler for task '{}'", task.getName());
@wytten
wytten / assembly.xml
Created June 14, 2013 14:25
Maven assembly plugin example that combines filesets and dependency sets
<assembly>
<id>install</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>src/assembly</directory>
@wytten
wytten / apache-poi.groovy
Created June 28, 2013 17:26
Create an Excel spreadsheet from Groovy (Java) using Apache POI 3.9
def export = {
// create a new file
FileOutputStream out = new FileOutputStream("workbook.xls");
// create a new workbook
Workbook wb = new HSSFWorkbook();
// create a new sheet
Sheet s = wb.createSheet();
int rownum = 0
for (ClaimDocumentReferenceDTO ref : docRefs) {
@wytten
wytten / authorized_keys
Created August 7, 2013 19:34
Setting up svn+ssh with cygwin
command="svnserve -t -r c:/svn" [public key from id_rsa.pub]
@wytten
wytten / gist:6187947
Created August 8, 2013 19:37
Check system-type within Emacs lisp
(cond ((eq system-type 'darwin) (insert-string "Steve"))
((eq system-type 'windows-nt) (insert-string "Bill"))
(t (insert-string "Congratulations")))
)
@wytten
wytten / delete.dql
Last active December 23, 2015 11:39
Delete a bunch of objects from Documentum based on name and location, using DQL
delete dm_document object where FOLDER ('/Your/Folder/Path',DESCEND) and object_name like '%.pdf'
@wytten
wytten / count.dql
Created September 19, 2013 21:20
Count a bunch of objects from Documentum based on name and location, using DQL
select count(*) from dm_document (ALL) where FOLDER ('/Your/Folder/Path',DESCEND) and object_name like '%.pdf'
@wytten
wytten / du.dql
Last active October 26, 2016 16:16
Documentum disk usage by cabinet or folder path, using DQL. The path is case-sensitive and you are not warned if the path does not exist.
select sum(r_full_content_size)/1024/1024/1024 as total_gb from dm_sysobject (all) where
folder('/cabinet/or/folder/path',descend);
@wytten
wytten / uncomment.sh
Created October 2, 2013 17:50
Edit one bash script from another, uncommenting a line
#!/bin/bash
vi flavour.sh << EOF
/BATCH_FLAVOUR-ua
:s/^#//
ZZ
EOF
@wytten
wytten / gist:7042616
Created October 18, 2013 14:45
Java JVM args for garbage collection found useful
java -XX:NewSize=256m -XX:MaxNewSize=256m -XX:+UseConcMarkSweepGC