Skip to content

Instantly share code, notes, and snippets.

View dialt0ne's full-sized avatar

Anthony Tonns dialt0ne

View GitHub Profile
#!/bin/bash
SSH_PUB_DIR="$HOME/.ssh/pub"
mkdir -p $SSH_PUB_DIR
for PRIVATE in *.pem;
do
PUBLIC=`echo $PRIVATE | sed 's/\(.*\).pem/\1/'`.pub;
if [ ! -f "$SSH_PUB_DIR/$PUBLIC" ]
then
echo $PRIVATE to $PUBLIC;
@dialt0ne
dialt0ne / datadog-nginx
Created February 26, 2016 17:12 — forked from gane5h/datadog-nginx
Nginx log parsing with datadog
"""
Custom parser for nginx log suitable for use by Datadog 'dogstreams'.
To use, add to datadog.conf as follows:
dogstreams: [path to ngnix log (e.g: "/var/log/nginx/access.log"]:[path to this python script (e.g "/usr/share/datadog/agent/dogstream/nginx.py")]:[name of parsing method of this file ("parse")]
so, an example line would be:
dogstreams: /var/log/nginx/access.log:/usr/share/datadog/agent/dogstream/nginx.py:parse
Log of nginx should be defined like that:
log_format time_log '$time_local "$request" S=$status $bytes_sent T=$request_time R=$http_x_forwarded_for';
when starting dd-agent, you can find the collector.log and check if the dogstream initialized successfully
"""
@dialt0ne
dialt0ne / get_aws_dns_ip.sh
Created December 17, 2015 22:44
Get AmazonProvidedDNS IP address from the EC2 meta-data
MAC_ADDR=`curl -s http://169.254.169.254/latest/meta-data/mac`
CIDR_FULL=`curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC_ADDR}/vpc-ipv4-cidr-block`
CIDR_BASE=`echo ${CIDR_FULL} | cut -d/ -f1 | cut -d\. -f1-3`
LAST_OCTET=`echo ${CIDR_FULL} | cut -d/ -f1 | cut -d\. -f4`
DNS_OCTET=`expr ${LAST_OCTET} + 2`
DNS_IP="${CIDR_BASE}.${DNS_OCTET}"
echo $DNS_IP
@dialt0ne
dialt0ne / ec2-get-ssh.sh
Created February 6, 2013 21:23
ec2-get-ssh for mageia
#!/bin/bash
#
# chkconfig: 2345 51 20
# processname: ec2-get-ssh
# description: Capture AWS public key credentials for EC2 user
# Source function library
. /etc/rc.d/init.d/functions
# Source networking configuration
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value={DBInstanceClassMemory/32}, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \
@dialt0ne
dialt0ne / ec2-get-ssh.sh
Created November 15, 2012 01:50 — forked from esoupy/ec2-get-ssh
Updated ec2 public key retrieval script. Added chkconfig and better default perms
#!/bin/bash
#
# chkconfig: 2345 51 20
# processname: ec2-get-ssh
# description: Capture AWS public key credentials for EC2 user
# Source function library
. /etc/rc.d/init.d/functions
# Source networking configuration