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
#!/usr/bin/env python | |
import xml.etree.ElementTree as ET | |
from urllib.request import urlopen | |
import random | |
import time | |
def seed(): | |
t = int( time.time() * 1000.0 ) |
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
#!/usr/bin/env python | |
import xml.etree.ElementTree as ET | |
ns = {'pom': "http://maven.apache.org/POM/4.0.0" , } | |
def find_exclusions(exclusions): |
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
// shamelessly stolen from https://discuss.gradle.org/t/preferred-way-to-publish-snapshots-releases-to-artifactory/20246/2 | |
// all I need to do it set -PreleaseVersion in the build | |
apply plugin: 'com.jfrog.artifactory' | |
apply plugin: 'java' | |
apply plugin: 'maven-publish' | |
//.. | |
if (project.properties.containsKey("releaseVersion")) { | |
version = version.split(/-/)[0] |
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 javax.management.remote.* | |
import javax.management.* | |
import groovy.jmx.builder.* | |
// see https://mongodb.github.io/mongo-java-driver/3.0/driver/reference/management/monitoring/ | |
attrs = ['CheckedOutCount','MinSize','MaxSize','WaitQueueSize','Size'] | |
def print_mbeans(def mbeans) { | |
def webBean = mbeans.queryNames(new ObjectName('org.mongodb.driver:*'), null).find { |
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 BigDecimalCodec implements Codec<BigDecimal> { | |
// Note that you may not want it to be double -- choose your own type. | |
@Override | |
public void encode(final BsonWriter writer, final BigDecimal value, final EncoderContext encoderContext) { | |
writer.writeDouble(value); | |
} | |
@Override | |
public BigDecimal decode(final BsonReader reader, final DecoderContext decoderContext) { | |
return reader.readDouble(); |
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
package grails3.event.driven | |
import reactor.spring.context.annotation.* | |
@Consumer | |
class EchoNumberService { | |
@Selector('int.echo') | |
void echo(Integer i) { | |
println "##### number id ${i}" |
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 java.sql.Types | |
public class MySqlServerDialect extends org.hibernate.dialect.SQLServerDialect { | |
public MySqlServerDialect() { | |
registerColumnType(Types.BIGINT, "bigint"); | |
registerColumnType(Types.BIT, "bit"); | |
registerColumnType(Types.CHAR, "nchar(1)"); | |
registerColumnType(Types.VARCHAR, 4000, "nvarchar(\$l)"); |
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
// Shameless stolen from http://stackoverflow.com/questions/25772324/defining-an-alternate-connection-pool-in-grails-2-3-6 | |
def config = Holders.config | |
def dataSources = config.findAll { | |
it.key.toString().contains("dataSource_") | |
} | |
dataSources.each { key, value -> | |
def ds = value |
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
#!/opt/local/bin/python | |
import time | |
import shutil | |
import os | |
dest = "/path/to/lima" | |
completed = [x for x in os.listdir(dest) if os.path.isdir(x)] | |
music = [x for x in os.listdir(".") if os.path.isdir(x)] |
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
# install Github Desktop to get their config | |
# then you can do this | |
# https://desktop.github.com/ | |
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1") | |
# then install psget and install modules | |
# before putting these lines in here | |
# see https://github.com/psget/psget | |
Import-Module PowerLs |