View gcloud_function_call.sh
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
gcloud --project my-project-id \ | |
functions call hello-world \ | |
--data '{}' \ | |
--region us-east1 |
View ec2_instance_creation_time.py
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 boto3 | |
import datetime | |
# iterator over EC2 instances for region | |
def ec2_instances(region): | |
client = boto3.client('ec2', region_name = region) | |
for reservation in client.describe_instances().get('Reservations', []): | |
for instance in reservation.get('Instances', []): | |
yield instance |
View ansible_pass_list.sh
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
ansible-playbook our_playbook.yml -e '{"our_var": ["one", "two", "three",]}' |
View lenses-cli-groups.sh
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
# Nice doc is here: https://docs.lenses.io/dev/lenses-cli/index.html | |
LENSES_CLI_CMD="lenses-cli --host https://10.0.17.20:9991/ --user admin --pass admin --insecure groups" | |
# Get the list | |
$LENSES_CLI_CMD get --output JSON | |
# Group config file | |
cat > config.yaml << EOF | |
name: windows_admins | |
description: "Admins from AD" |
View git_log.sh
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
# See git log --help for details | |
git log --reverse --after='Jan 19' --format='format:%h %an' |
View check_keytabs.sh
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 | |
# Check all keytabs in the current directory | |
for kt in *.keytab | |
do | |
pr=$(klist -k $kt | tail -1 | awk '{print $2}') | |
echo -n "${kt}: " | |
kinit -kt $kt $pr > /dev/null 2>&1 && echo OK || echo FAILED | |
done |
View get_java_rpm_version.py
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 rpm | |
for pkg in rpm.TransactionSet().dbMatch('provides', 'java'): | |
print '%s:%s:%s:%s' % (pkg['name'], pkg['version'], pkg['release'], pkg['epoch']) |
View md5_pass_encrypt.py
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 crypt | |
crypt.crypt('my-secret-word', '$1$someSalt$') |
View summarize_by_day.prometheus
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
sum(increase(kafka_producer_topic_metrics_record_send_total{topic = "$my_topic_name"}[1d])) |
View kafka_topics_delete.sh
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
TOPIC_NAME_REGEX='(CI|TST|IT)[0-9]' | |
ZOOKEEPER_ADDR=127.0.0.1:2181 | |
for topic in $(kafka-topics --zookeeper $ZOOKEEPER_ADDR --list | egrep $TOPIC_NAME_REGEX) | |
do | |
kafka-topics --zookeeper $ZOOKEEPER_ADDR --delete --topic $topic | |
done |
NewerOlder