Skip to content

Instantly share code, notes, and snippets.

@ghaering
ghaering / dbg-cloud-init
Created May 27, 2014 07:22
Re-run cloud init scripts on Ubuntu 12.04 (AWS)
#!/bin/sh
rm -rf /var/lib/cloud/sem/* /var/lib/cloud/instance /var/lib/cloud/instances/*
cloud-init start 2>&1 > /dev/null
cloud-init-cfg all final
@wjrogers
wjrogers / dfhack_workflow.txt
Created March 4, 2012 20:18
dfhack configuration
# enable the plugin
workflow enable drybuckets auto-melt
# farming
workflow amount FOOD 120 30
workflow amount DRINK 300 50
workflow amount THREAD//GRASS_TAIL_PIG:THREAD 30 20
workflow count LIQUID_MISC//POD_SWEET:EXTRACT 20 10
# storage
@timuruski
timuruski / pre-commit.rubocop
Last active February 1, 2019 13:10
Pre-Commit Rubocop check
#!/bin/sh
# Simplified from this script, (less robust and more to the point):
# http://gmodarelli.com/2015/02/code-reviews-rubocop-git-pre-commit/
# Installation: copy this code into <REPO>.git/hooks/pre-commit.sh
# Select only staged Ruby files
FILES="$(git diff --cached --name-only --diff-filter=AMC | grep "\.rb$" | tr '\n' ' ')"
# iops
resource "aws_db_instance" "rds" {
identifier = "${var.identifier}"
allocated_storage = "${var.allocated_storage}"
iops = "${var.iops}"
engine = "${var.engine}"
engine_version = "${var.engine_version}"
instance_class = "${var.instance_class}"
name = "${var.db_name}"
username = "${var.db_username}"
#!/bin/bash
wget https://github.com/gravitational/teleport/releases/download/v0.2.0-beta.1/teleport-v0.2.0-beta.1-linux-amd64-bin.tar.gz
tar -xvzf teleport-v0.2.0-beta.1-linux-amd64-bin.tar.gz
cd teleport
sudo mkdir -p /opt/bin /opt/teleport
sudo cp -af build/* /opt/bin/
sudo cp -fr src/github.com/gravitational/teleport/web/dist/* /opt/teleport/
@smougenot
smougenot / A_Logstash.conf
Created July 26, 2012 13:59
Logstash Multiline Filter for Java Stacktrace (tested on field)
# stacktrace java as one message
multiline {
#type => "all" # no type means for all inputs
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)"
what => "previous"
}
@miketheman
miketheman / linux_entropy.py
Created December 31, 2015 21:11
Datadog Agent Linux Entropy Available
from checks import AgentCheck
class LinuxEntropyCheck(AgentCheck):
def check(self, instance):
with open('/proc/sys/kernel/random/entropy_avail', 'r') as procfile:
data = procfile.read().strip()
self.gauge('system.kernel.entropy_available', int(data))
@stefano-pogliani
stefano-pogliani / Dockerfile
Created September 13, 2017 14:23
Locking docker containers with slow fluentd/network
FROM debian:jessie
RUN apt-get update \
&& apt-get install -y python-pip \
&& pip install --upgrade pip flask
COPY ./server.py /server.py
EXPOSE 5000
ENV FLASK_APP=server.py
@sakalajuraj
sakalajuraj / squid.conf
Last active August 1, 2020 00:48
Logstash filter for squid log
# Content of the file /etc/logstash/conf.d/squid.conf
# Squid logs MAC address of the source host
# Logs are sending by syslog-ng raw without standard log headers
input {
tcp {
host => "xxx.xxx.xxx.xxx"
port => xxxx
type => SQUID
tags => [SQUID]
# using rvm with ruby-1.8.7-p249
# latest version 2.7.7 2010-06-17
brew install libxml2
# installing libxslt from source code
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
tar xvfz libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7