Skip to content

Instantly share code, notes, and snippets.

View dragolabs's full-sized avatar

Vitaly Shishlyannikov dragolabs

View GitHub Profile
@tmatilai
tmatilai / debian7.erb
Created May 20, 2013 13:56
Chef `knife bootstrap` template for Debian 7.0 Wheezy until it is supported by Opscode: http://tickets.opscode.com/browse/CHEF-4125
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
exists() {
if command -v $1 &>/dev/null
then
return 0
else
return 1
fi
@jtimberman
jtimberman / berksfile.rb
Created September 3, 2013 21:23
walk through all the cookbooks in the cookbooks directory and add a berksfile entry for each one at the path location. doesn't work so well on large repos.
Dir.glob(File.join(File.dirname(__FILE__), "cookbooks", "*")).each do |cb|
cookbook File.basename(cb), :path => cb
end
"""A little script to recover deleted recording of a mongoDB db file
There's no optimization but it work and has saved me
"""
import struct
import bson
import sys
@pburkholder
pburkholder / selfsigned.md
Last active August 22, 2016 15:55
Poking at Supermarket and Berkshelf and self-signed certs

Notes

ssl testing

Even with ssl.verify off, berks install or berks vendor will fail when supermarket is using a self-signed certificate. So, how do we get around that?

Note: I hacked my /etc/hosts to resolve supermarket-0.c.cheffian-supermarket.internal

Get the CERT

@Synesso
Synesso / delete_empty_logsets.sh
Created May 26, 2017 02:26
Delete empty LogEntries logsets on OSX
# pip install logentries-lecli
# then configure as per https://blog.logentries.com/2016/07/introduction-to-the-logentries-command-line-interface/
# logsets with logs in them
lecli get logs | jq -r '.logs[].logsets_info[].id' | sort -u > have_logs
# all logset ids
lecli get logsets | jq -r '.logsets[] | .id' | sort > logsets
for ls in $(comm logsets have_logs | grep -v "$(printf '\t')")
@mtnygard
mtnygard / responses.clj
Last active July 16, 2019 20:16
Build Pedestal response maps for every standard HTTP status code.
(defn response
([status body]
{:status status
:headers {}
:body body}))
(defmacro http-status [code sym]
`(def ~sym (partial response ~code)))
(defmacro http-statuses [& pairs]
@brablc
brablc / postfix_grok_pattern
Last active September 27, 2020 20:10
Logstash example configuration for parsing Postfix mail log files
# Postfix stuff based on https://gist.github.com/jbrownsc/4694374:
QUEUEID (?:[A-F0-9]+|NOQUEUE)
EMAILADDRESSPART [a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILADDRESSPART:local}@%{EMAILADDRESSPART:remote}
RELAY (?:%{HOSTNAME:relayhost}(?:\[%{IP:relayip}\](?::[0-9]+(.[0-9]+)?)?)?)
POSREAL [0-9]+(.[0-9]+)?
DELAYS (%{POSREAL}[/]*)+
DSN %{NONNEGINT}.%{NONNEGINT}.%{NONNEGINT}
STATUS sent|deferred|bounced|expired
@jalsot
jalsot / qemu-debian-create-image
Last active October 27, 2020 03:24 — forked from spectra/qemu-debian-create-image
Debian qemu image creation using debootstrap (automated from http://diogogomes.com/2012/07/13/debootstrap-kvm-image/ by Kamil Trzcinski (http://ayufan.eu) with some modifications by me)
#!/bin/bash
# Configs overwritable via environment variables
VSYSTEM=${VSYSTEM:=qemu} # Either 'qemu' or 'kvm'
FLAVOUR=${FLAVOUR:=debian} # Either 'debian' or 'ubuntu'
INCLUDES=${INCLUDES:="less,vim,sudo,openssh-server,acpid"}
MIRROR=${MIRROR:="http://ftp.hu.debian.org/debian"}
#MIRROR=${MIRROR:="http://localhost:3142/debian"}
#MIRROR=${MIRROR:="http://hu.archive.ubuntu.com/ubuntu/"}
#MIRROR=${MIRROR:="http://localhost:3142/ubuntu"}
@mmoulton
mmoulton / README.md
Last active November 7, 2020 18:19
Docker Container Stats Collection Using Collectd

Docker stats collection for collectd

This script can be used to feed collectd with cpu and memory usage statistics for running docker containers using the collectd exec plugin.

This script will report the used and cached memory as well as the user and system cpu usage by inspecting the appropriate cgroup stat file for each running container.

Usage

This script is intented to be executed by collectd on a host with running docker containers. To use, simply configure the exec plugin in collectd to execute the collectd-docker.sh script. You may need to adjust the script to match your particulars, such as the mount location for cgroup.