Skip to content

Instantly share code, notes, and snippets.

046588baa88c67ee2a59154f5428ff3717cca9361d9e0973e21b5b063591d60b3a69be8827bdf8dc4a76d955605e8c5e77ff2e6b482da20615109a25d74320ece2
filebeat.prospectors:
- input_type: log
paths:
- /mnt/log/*.log
processors:
- add_cloud_metadata:
output.elasticsearch:
hosts: ['elasticsearch:9200']
function daysInMonth(month, year){
return new Date(year, month, 0).getDate();
}
function estimate(current){
d = new Date();
n = d.getDate();
h = d.getHours();
y = d.getFullYear();
m = d.getMonth() + 1;
#!/bin/bash
# 2017-03-27 [email protected]
if [ $# -lt 1 ]
then
cat << HELP
dockertags -- list all tags for a Docker image
@charlesmims
charlesmims / mesos_cadvisor_prometheus_grafana
Created December 6, 2016 22:27
monitoring docker containers in mesos with prometheus and cadvisor and grafana
# This marathon.json deploys cadvisor to each node and exposes it on port 3002.
cadvisor/marathon.json
{
"id": "cadvisor",
"cpus": 0.1,
"mem": 100,
"disk": 0,
"instances": 8, // equal to number of agent nodes you have
"constraints": [["hostname", "UNIQUE"]],
Elastic.co's past-releases section of their website is unuseable.
I wrote this script to parse all the pages of that site and just spit out all the links
so you can just search for what you want.
Isn't it ironic not being able to search for something on elasticsearch's website?
#!/usr/bin/env python
import requests
import re
#!/usr/bin/env python
# @charlesmims 2015
# Maintains a number of coreOS hosts running in ec2. Can be used to scale up by increasing NUM_NODES,
# but in present state will not scale down cleanly.
import boto.ec2
import time
from os import environ
from collections import defaultdict
Add the following to your ~/.bashrc and your bash history will be saved to a coherent, time-stamped, persistant history file.
shopt -s histappend
export HISTIGNORE=ignoreboth
export HISTFILESIZ=1000000
export HISTSIZE=1000000
export HISTTIMEFORMAT='%F %T '
export PROMPT_COMMAND='history -a'
#!/usr/bin/env python
"""
Bytes-to-human / human-to-bytes converter.
Based on: http://goo.gl/kTQMs
Working with Python 2.x and 3.x.
Author: Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>
License: MIT
"""
#!/usr/bin/env python
# make this file executable and save it in /usr/local/bin/.
# pipe gpg ascii-armored code to it to strip it into a simple string
# pipe the simple string to it to get the original formatting back which
# you can pipe into gpg.
import fileinput
message = ''