This file contains hidden or 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 | |
if [[ $# -ne 3 ]]; then | |
echo "Finds and replaces patterns in remote URLs for all git repos under the PWD" | |
echo " Usage:" | |
echo " $0 remote_name old_pattern new_pattern" | |
echo " Example:" | |
echo " $0 origin myoldorg myneworg" | |
echo " Would find git repos under the PWD with 'myoldorg' in their URLs for" | |
echo " their origin remotes, and replace 'myoldorg' with 'myneworg' in each URL" |
This file contains hidden or 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 com.fasterxml.jackson.core.JsonGenerator | |
import com.fasterxml.jackson.core.JsonProcessingException | |
import com.fasterxml.jackson.databind.ObjectMapper | |
import com.fasterxml.jackson.databind.SerializerProvider | |
import com.fasterxml.jackson.databind.module.SimpleModule | |
import com.fasterxml.jackson.databind.ser.std.StdSerializer | |
import org.springframework.beans.factory.annotation.Autowired | |
import org.springframework.stereotype.Component | |
@Component |
This file contains hidden or 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 groovy | |
def rocketParts = [ | |
' /\\', | |
'/ \\', | |
' ||', | |
' ||', | |
' ||', | |
' ||', | |
' ||', |
This file contains hidden or 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
/** | |
* Put in an init script, e.g.: $HOME/.gradle/init.d/printProperties.gradle | |
* Then call from a gradle project, e.g.: gradle printVersion | |
*/ | |
allprojects { Project project -> | |
tasks.addRule( "print<PropertyName> - print the value of a property in this and any subprojects" ) { String taskName -> | |
if ( taskName.startsWith( "print" ) ) { | |
def propName = (taskName - 'print') | |
propName = propName[0].toLowerCase() + propName[1..-1] | |
task( taskName ) << { println "${propName}: ${project.properties[propName]}" } |
This file contains hidden or 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
def generateMD5( File file ) { | |
def digest = java.security.MessageDigest.getInstance("MD5") | |
file.eachByte( 4096 ) { buffer, length -> | |
digest.update( buffer, 0, length ) | |
} | |
new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0') | |
} |
This file contains hidden or 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 static java.math.RoundingMode.* | |
import java.math.RoundingMode | |
/* | |
To round to a multiple: | |
1) normalize the input by dividing it by the multiple value. | |
2) round it to the nearest integer using the desired rounding technique | |
3) multiply that integer by the multiple value to produce the result | |
NOTES: |