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 -e | |
git fetch origin -p | |
REMOTE=$(git branch -r | sed "s/origin\///g") | |
BRANCHES=$(git branch | awk -F ' +' '! /\(no branch\)/ {print $2}') | |
for branch in $BRANCHES; do | |
if [[ -z $(echo $REMOTE | grep -w $branch) ]]; then | |
git branch -D $branch | |
fi | |
done |
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
from hvac import Client | |
import yaml | |
class | |
class Config: | |
def _load_config(self): | |
client = Client(url = self.vault_url) | |
client.auth_approle(self.role_id, self.secret_id) |
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 | |
PGHOST=$1 | |
PGPORT=$2 | |
PGUSER=$3 | |
PGPASSWORD=$4 | |
PGDATABASE=$5 | |
if [[ -z "$PGHOST" ]] || [[ -z "$PGPORT" ]] || [[ -z "$PGUSER" ]] || [[ -z "$PGPASSWORD" ]] || [[ -z "$PGDATABASE" ]]; then | |
echo "Usage: ./dump.sh [HOST] [PORT] [USERNAME] [PASSWORD] [DB]" |
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 IDGenerator { | |
static final String ID_SYMBOL_SET = "ABCDEFGHJKMNPQRSTUVWXYZ23456789"; | |
public static String generateEncoderId(int length) { | |
StringBuilder buffer = new StringBuilder(length); | |
for(int i = 0; i < length; ++i) { | |
Integer idx = random.nextInt(ID_SYMBOL_SET.length()); | |
buffer.append(ID_SYMBOL_SET.charAt(idx)); | |
} | |
return buffer.toString(); |
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 FOREIGN_KEY_CHECKS = 0; | |
SET GROUP_CONCAT_MAX_LEN=32768; | |
SET @tables = NULL; | |
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables | |
FROM information_schema.tables | |
WHERE table_schema = "hydradb"; | |
SELECT IFNULL(@tables,'dummy') INTO @tables; | |
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables); | |
PREPARE stmt FROM @tables; |