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
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 / 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}"
@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
      & ~
    
@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
View brew list
-> ~ $ brew list
adns freetype gmp kubernetes-helm libgcrypt libsoxr lzo opus readline terraform webp
aom frei0r gnupg lame libgpg-error libtasn1 ncurses p11-kit rtmpdump terraform@0.11 wget
awscli fribidi gnutls leptonica libidn2 libtiff nettle pcre rubberband tesseract x264
cairo gdbm graphite2 libass libksba libunistring node pcre2 sdl2 theora x265
cli53 gettext harfbuzz libassuan libogg libusb npth pinentry shellcheck tmux xvid
ffmpeg giflib icu4c libbluray libpng libvorbis opencore-amr pixman snappy unbound xz
flac git jpeg libevent libsamplerate libvpx openjpeg pwgen speex vault yarn
fontconfig glib kubernetes-cli libffi libsndfile little-cms2 openssl python sqlite watch youtube-dl
You can’t perform that action at this time.