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
with temp as (select d_codigo | |
from (select d_codigo,d_estado, length(d_codigo) | |
from colonia_tmp | |
group by d_codigo,d_estado | |
having length(d_codigo) = 4) newcode) | |
update colonia_tmp set d_codigo= '0' || d_codigo where d_codigo in (select d_codigo from temp); |
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
def dynamicMethods = [ | |
[regex:"hasPermission(.*)", method:this.&hasPermission], | |
[regex:"create(.*)Permission", method:this.&createPermission]] | |
def methodMissing(String name, args) { | |
def method = dynamicMethods.find { name =~ it.regex} | |
if(method) { | |
def match = name =~ method.regex | |
return method.method(match[0][1], * args) | |
} else |
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
some_articles | |
.collectMany{article -> article.tags.collect{ [ ( it ), article] }} | |
.groupBy{it.first()} | |
.collectEntries {k,v -> [( k ): v.collect {it.last()}]} | |
.collect {k,v -> [( k ):[articles: v.size(),words:v.collect{it.words}.inject(0) { acc, val -> acc + val }] ]} |
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
file = new File('input.txt') | |
board = [][] | |
file.eachWithIndex {obj, i -> | |
if (i == 0) { | |
(rows, columns) = obj.split(" ")*.toInteger() | |
} else { | |
board << ([0] << obj.collect{ it == '*'?'*':0 } << [0]).flatten() | |
} | |
} |
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
class DemoDynamic { | |
Map<String, List<String>> permissions = [:] | |
Boolean hasPermission(String name, String permission){ | |
permission in permissions?."$name" | |
} | |
Map createPermission(String name, List<String> permissions) { | |
this.permissions?."$name" = permissions | |
this.permissions |
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
for i in `aws rds describe-db-log-files --db-instance-identifier ${INSTANCE} --output text | awk '{print $3}' | sed '$d' ` ; do | |
FILE=`basename ${i}` | |
if [ ! -e ${INSTANCE}/${FILE} ]; then | |
aws rds download-db-log-file-portion --db-instance-identifier ${INSTANCE} --log-file-name ${i} --output text > ${INSTANCE}/${FILE} | |
fi |
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
#!/bin/bash | |
INSTANCES="sepa-prod-db-replica-analysis sepa-prod-db-replica1 sepa-prod-db-replica2 sepa-prod-db-replica3 sepa-prod-db-replica4" | |
DATE=$(date +"%Y-%m-%d") | |
FILENAME=$(aws rds describe-db-log-files --db-instance-identifier sepa-prod-db-replica1 --filename-contains $DATE --max-items 1 --output text | awk '{print $3}') | |
#filename="error/postgresql.log.2016-05-14-13" | |
for DB_INSTANCE in $INSTANCES ; do | |
echo $DB_INSTANCE | |
aws rds download-db-log-file-portion --db-instance-identifier $DB_INSTANCE --log-file-name $FILENAME --output text | grep 'ERROR: prepared statement\|connection to client lost' |
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 json | |
import boto3 | |
import logging | |
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG) | |
logger = logging.getLogger() | |
CONFIG = {'hgmigueldb-replica1': 'i-847d9502'} | |
def get_source_id(message): |
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
set serverGroupName=${env.WILDFLY_SERVER_GROUP_NAME} | |
set portOffset=${env.WILDFLY_PORT_OFFSET} | |
set host=${env.WILDFLY_HOST} | |
set maxHeapSize=${env.WILDFLY_MAX_HEAP_SIZE} | |
set permgenSize=${env.WILDFLY_PERMGEN_SIZE} | |
set jvmOptions=${env.WILDFLY_JVM_OPTIONS} | |
batch |
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
promotionProcess.getPromotionCondition("hudson.plugins.promoted_builds.conditions.ManualCondition").setUsers(build.getEnvVars()["APPROVERS"]) | |
return true |
OlderNewer