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
names=( $(az keyvault secret list --vault-name [oldvault] | jq '.[] | .name') ) | |
for name in "${names[@]}" | |
do | |
name=`echo $name | tr -d '"'` | |
value=`az keyvault secret show --name $name --vault-name [oldvault] | jq '.value' | tr -d '"'` | |
echo "setting $name..." | |
az keyvault secret set --name "$name" --vault-name [newvault] --value "$value" | |
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
# Ubuntu | |
sudo add-apt-repository ppa:gnome-terminator | |
sudo apt-get update | |
sudo apt-get install terminator | |
# Fedora | |
yum install terminator |
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
table_exists() { | |
db_url="$1" | |
user="$3" | |
password="$4" | |
schema="$2" | |
if [[ ! -z $(mysql -Ns -h"$db_url" -u"$user" -p"$password" -e "select schema_name from information_schema.schemata where | |
schema_name='${schema}';") ]]; then | |
echo "schema exists" | |
return 0 | |
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 | |
read -rp "What is the new access_key: " access_key | |
read -rp "What is the new secret_key: " secret_key | |
enc_access=$(echo "$access_key" | base64) | |
enc_secret=$(echo "$secret_key" | base64) | |
echo "encrypted access key: $enc_access" | |
echo "encrypted secret key: $enc_secret" |
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
docker ps -aqf "name=rmq" | xargs -I{} docker exec {} bash -c "rabbitmqctl stop_app ; rabbitmqctl reset ; rabbitmqctl start_app" |
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
/** | |
* Assume we are interested in finding the first two even numbers in a very big file. | |
* Since we love functional programming, we don't want to use the traditional for loops. | |
* Instead, we want to apply a series of function to get the desired output. | |
*/ | |
// for the sake of the example, I assume the input is found in a list, not a file | |
var l = List(1, 47, 38, 53, 51, 67, 39, 46, 93, 54, 45, 33, 87, 96, 100, 4, 84, 17, 31, 81, 88, 35, 36) | |
// we don't really need toList here, but since we're assuming the data is coming from a file, I'll use it anyway |
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 requests | |
import json | |
uri = 'http://localhost:15677/api/queues' | |
res = json.loads(requests.get(uri, auth=('username', 'password')).content) | |
for i in res: | |
print('{:<40}: {} {}'.format(i.get('name'), i.get('state'), i.get('consumers'))) |
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 | |
curl -O https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.23.0.tar.gz | |
tar -xvf git-2.23.0.tar.gz | |
cd git-2.23.0/ | |
./configure | |
make && make install | |
cp git /usr/local/bin/git |
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
{ | |
"contexts": { | |
"application-1": { | |
"beans": { | |
"spring.transaction-org.springframework.boot.autoconfigure.transaction.TransactionProperties": { | |
"prefix": "spring.transaction", | |
"properties": {} | |
}, | |
"management.trace.http-org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceProperties": { | |
"prefix": "management.trace.http", |
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.time.Duration; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.cache.CacheManager; | |
import org.springframework.cache.annotation.CachingConfigurerSupport; | |
import org.springframework.cache.annotation.EnableCaching; | |
import org.springframework.cache.concurrent.ConcurrentMapCacheManager; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; |
NewerOlder