Skip to content

Instantly share code, notes, and snippets.

View cachedout's full-sized avatar
🏠
Working from home

Mike Place cachedout

🏠
Working from home
View GitHub Profile
@ycombinator
ycombinator / instructions.md
Created April 2, 2019 14:19
Testing Monitoring Across Versions

Test if Monitoring Cluster version X is able to monitor Production Cluster version Y, where X > Y.

  1. Download and install Elasticsearch version X. This will be the Monitoring Cluster
  2. Download and install Elasticearch version Y. This will be the Production Cluster
  3. Download and install Kibana version Y. This will be the Production Kibana
  4. Start the Monitoring Cluster:
    bin/elasticsearch -E cluster.name=esmon -E node.name=esmon_1 -E http.port=9400
    
  5. Start the Production Cluster:
@simonw
simonw / recover_source_code.md
Last active June 21, 2024 00:11
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@pickypg
pickypg / metrics-to-monitor.md
Created November 20, 2014 16:36
Metrics to Monitor

Elasticsearch has many metrics that can be used to determine if a cluster is healthy. Listed below are the metrics that are currently a good idea to monitor with the reason(s) why they should be monitored and any possible recourse for issues.

Unless otherwise noted, all of the API requests work starting with 1.0.0.

Metrics

Metrics are an easy way to monitor the health of a cluster and they can be easily accessed from the HTTP API. Each Metrics table is broken down by their source; the version of Elasticsearch that is required to retrieve the metric is noted by its name if it is not present in 1.0.0.

Each metric has an associated warning level and error level. These levels are meant to indicate when the associated Metric should be monitored versus acted upon as soon as possible.

@gnarf
gnarf / ..git-pr.md
Last active April 12, 2024 22:00
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@levigross
levigross / djangoratelimit.py
Created November 29, 2010 02:05
Cache based rate limiting in Django
from django.core.cache import cache
from django.http import HttpResponseForbidden
from functools import wraps
from django.utils.decorators import available_attrs
def ratelimit(limit=10,length=86400):
""" The length is in seconds and defaults to a day"""
def decorator(func):
def inner(request, *args, **kwargs):
ip_hash = str(hash(request.META['REMOTE_ADDR']))