Skip to content

Instantly share code, notes, and snippets.

Alex Trepca atrepca

Block or report user

Report or block atrepca

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@atrepca
atrepca / kafka.service
Created Sep 27, 2016
Kafka Systemd Service Configuration File for Ubuntu 16.04
View kafka.service
[Unit]
Description=Apache Kafka server (broker)
Documentation=http://kafka.apache.org/documentation.html
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
PIDFile=/var/run/kafka.pid
User=kafka
@atrepca
atrepca / ec2tags.sh
Last active Aug 29, 2015
Create custom Puppet fact from AWS EC2 instance tags
View ec2tags.sh
#!/bin/bash
# Requirements:
# * aws-cli: https://github.com/aws/aws-cli
# * IAM roles or aws access key and secret in place
TAG_NAME="mytag"
INSTANCE_ID="$(/usr/bin/curl -s http://instance-data/latest/meta-data/instance-id)"
REGION="$(/usr/bin/curl -s http://instance-data/latest/meta-data/placement/availability-zone | /bin/sed -e 's/[a-z]$//')"
TAG_VALUE="$(/usr/local/bin/aws ec2 describe-tags --filters "Name=resource-id,Values=${INSTANCE_ID}" "Name=key,Values=${TAG_NAME}" --region ${REGION} --output=text | /usr/bin/cut -f5)"
echo "mytag_fact=${TAG_VALUE}"
View backup-github-org.sh
#!/bin/bash
#
# SOURCE: this is an adaptation of the following gists:
# * https://gist.github.com/rodw/3073987 - original
# * https://gist.github.com/bjtitus/8851816 - modification of the original /w pagination for more than 30 repos
#
# SCOPE: backup an organization's GitHub repositories with issues and wikis
#
# Uses the GitHub API to pull down the list of repos & clone them
#
@atrepca
atrepca / gist:7159195
Last active Jan 23, 2016
Send Heroku logs to an rsyslog server and save them to separate files by application
View gist:7159195
  • Add a Heroku drain for your app to forward the logs to your rsyslog server:

      heroku drains:add --app my-prod-app syslog://logging01.prod.mydomain.net:514
    
  • List the drain you just created to get the unique Drain ID:

      heroku drains -x --app my-prod-app
    
  • On the rsyslog server save the logs coming from Heroku to separate files, without duplicating to /var/log/messages (thanks to the & ~). Create a /etc/rsyslog.d/90-heroku.conf file containing:

      if $HOSTNAME startswith 'Drain_ID' then /opt/log/heroku/my-prod-app.log
      & ~
    
You can’t perform that action at this time.