Skip to content

Instantly share code, notes, and snippets.

View marcgeld's full-sized avatar

Marcus Gelderman marcgeld

View GitHub Profile
@marcgeld
marcgeld / decrypt_dbvis.py
Last active September 11, 2015 11:49 — forked from gerry/decrypt_dbvis.py
A quick hack to extract and decrypt credentials from DbVisualizer config files.
#!/usr/bin/env python
# decrypt_dbvis.py ~ gerry@twitter.com
# DbVisualizer uses PBEWithMD5AndDES with a static key to store passwords.
# This is a quick hack to extract and decrypt credentials from DbVisualizer config files.
# Tested against DbVisualizer Free 9.0.9 and 9.2.10
"""
[2014-03-25 02:05:30][not-the-sea workspace]$ security/p/gerry/misc/decrypt_dbvis.py
[+] DbVisualizer Password Extractor and Decryptor (@gerryeisenhaur)
[+] Additional Usage Options:
[+] security/p/gerry/misc/decrypt_dbvis.py <config filename>
@marcgeld
marcgeld / brew-sync.sh
Created September 30, 2015 21:08 — forked from jpawlowski/brew-sync.sh
Sync Homebrew installations between Macs via Dropbox
#!/bin/bash
# Sync Homebrew installations between Macs via Dropbox
#
BREW="/usr/local/bin/brew"
# first get local settings
echo "Reading local settings ..."
rm -f /tmp/brew-sync.*
let healthStore = HKHealthStore()
@marcgeld
marcgeld / amqtransceiver.groovy
Last active February 24, 2016 14:34
Groovy script to copy incoming message from one in-queue to a out-queue
#! /usr/bin/env groovy
// 1.) Start ActiveMQ on localhost (...or other hosts)
// 2.) Run with ./amqtransceiver.groovy -t --inqueue one --outqueue two --activemqurl tcp://localhost:61616
@Grab(group='org.apache.activemq', module='activemq-core', version='5.7.0')
@Grab(group='commons-io', module='commons-io', version='1.2')
@Grab(group='org.apache.geronimo.specs', module='geronimo-jms_1.1_spec', version='1.1.1')
@Grab(group='org.apache.qpid', module='qpid-amqp-1-0-client-jms', version='0.30')
@Grab(group='ch.qos.logback', module='logback-classic', version='1.1.5')
@marcgeld
marcgeld / pdfextractor.groovy
Created February 25, 2016 10:42
Groovy script that extracts images from a pdf-file
#! /usr/bin/env groovy
//@GrabConfig(systemClassLoader=true)
@Grab(group='ch.qos.logback', module='logback-classic', version='1.1.2')
@Grab(group='org.apache.pdfbox', module='pdfbox', version='2.0.0-RC3')
import org.apache.pdfbox.pdfwriter.*
import org.apache.pdfbox.pdmodel.*
import org.apache.pdfbox.pdmodel.font.*
@marcgeld
marcgeld / amqfilesender.groovy
Created March 16, 2016 07:23
Send a file to ActiveMQ Queue
#! /usr/bin/env groovy -cp ./activemq-client-5.12.0.jar:./logback-classic-1.1.3.jar
@Grab(group='ch.qos.logback', module='logback-classic', version='1.1.5')
@Grab(group='ch.qos.logback', module='logback-core', version='1.1.5')
@Grab(group='org.slf4j', module='slf4j-api', version='1.7.16')
@Grab(group='org.apache.activemq', module='activemq-core', version='5.7.0')
@Grab(group='org.apache.qpid', module='qpid-amqp-1-0-client-jms', version='0.30')
@Grab(group='commons-io', module='commons-io', version='1.2')
@Grab(group='org.apache.geronimo.specs', module='geronimo-jms_1.1_spec', version='1.1.1')
@marcgeld
marcgeld / testtext.groovy
Created June 3, 2016 11:15
Generates a lot of text
#! /usr/bin/env groovy
import java.nio.file.attribute.BasicFileAttributes
TEXT_LEN = 9999 * 2
TEST_TEXT = "Alfa Beta"
def text = ""
def ratio = TEXT_LEN / TEST_TEXT.length()
@marcgeld
marcgeld / MakeLargeCsvFile.groovy
Last active September 15, 2016 09:40
Makes a large csv file
#!/usr/bin/env groovy
// Run with: groovy MakeLargeCsvFile.groovy -r 12 --file a.csv
import groovy.text.SimpleTemplateEngine
def appName = this.getClass().getName()
def cli = new CliBuilder(usage:"${appName} --rows <row count> --file <path_to_file>")
cli.with {
r(longOpt: 'rows', 'expected row count', args: 1, required: true)
#!/usr/bin/env groovy
import groovy.io.FileType
def printelnerr = System.err.&println
def appName = this.getClass().getName()
def cli = new CliBuilder(usage:"${appName} --basedir <path_to_dir> --diffdir <path_to_dir> [--pattern old/new]")
cli.with {
@marcgeld
marcgeld / base64.groovy
Created November 18, 2016 10:30
Base64 encode & decode
#!/usr/bin/env groovy
@Grab(group='commons-codec', module='commons-codec', version='1.10')
import org.apache.commons.codec.binary.Base64
def plainText = "PasswordText"
def encodedText = new String(Base64.encodeBase64(plainText.getBytes()))
def decodedText = new String(Base64.decodeBase64(encodedText.getBytes()))