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 bash | |
function get_headphones_index() { | |
echo $(pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}') | |
} | |
function get_headphones_mac_address() { | |
local temp=$(pacmd list-cards | grep bluez_card -C20 | grep 'device.string' | cut -d' ' -f 3) | |
temp="${temp%\"}" | |
temp="${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
#!/bin/bash | |
NUMBER=$1 | |
BTC=$(curl --silent "https://api.bitso.com/v3/ticker/?book=btc_mxn" | jq -r '.payload.last') | |
echo "$BTC$NUMBER" | |
echo $BTC | |
while (( $(echo "$BTC$NUMBER" | bc -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
promotionProcess.getPromotionCondition("hudson.plugins.promoted_builds.conditions.ManualCondition").setUsers(build.getEnvVars()["APPROVERS"]) | |
return true |
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
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
#!/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
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
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
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
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 }] ]} |
NewerOlder