Skip to content

Instantly share code, notes, and snippets.

@dmitri-lerko
dmitri-lerko / rules.yaml
Created October 25, 2021 14:57
Dynamic prometheus alert rules based on team label
# List of kube_*_labels metrics - not all of these are useful for alerting.
# kube_certificatesigningrequest_labels
kube_certificatesigningrequest_labels * on (certificatesigningrequest) group_right(label_team) (
...insert expression here
)
# kube_cronjob_labels
kube_cronjob_labels * on (cronjob, namespace) group_right(label_team) (
...insert expression here
)
@epcim
epcim / kubernetes_pods_docker_disk_usage.md
Last active January 22, 2024 03:57
docker disk space introspection kubernetes docker overlay

identify big pods/containers

investigage big files

DST=/mnt
find /var/lib -type f -size +1G -exec ls -lh {} \; | tee  $DST/bigfiles_var_lib_$(date "+%H%M").log
find /var/lib -type f -size +1G -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -rh > $DST/bigfiles_var_lib_$(date "+%H%M").sorted.log

misbehave processes

// Description:
// Allows Hubot to create channels for incidents on the fly
//
// Configuration:
// None
//
// Commands:
// hubot create incident <name> - automagically creates an incident channel + invites all users
const { WebClient } = require('@slack/client');
@maelvls
maelvls / How-to-automate-build-bottles-your-homebrew-tap.md
Last active May 12, 2024 15:10
Automate build workflow for Homebrew tap bottles (Linux and macOS)

How to automate the build of bottles on your Homebrew tap

Note on Oct 4, 2018: due to a change in Homebrew's brew test-bot behaviour, the user must set HOMEBREW_TRAVIS_CI and HOMEBREW_TRAVIS_SUDO appropriately (it was previously using Travis-CI-provided TRAVIS and TRAVIS_SUDO).

This tutorial is a follow-up to the discussion we had on davidchall/homebrew-hep#114. It relies on a fork of the test-bot provided by davidchall; you can get it with brew tap maelvalais/test-bot. First:

  1. the Github project must be of the form https://github.com//homebrew- with the following tree
var KlaviyoSubscribe = KlaviyoSubscribe || {};
(function() {
if (!KlaviyoSubscribe._loaded) {
KlaviyoSubscribe._loaded = !0;
var m = {
"modal.html": '<div class="klaviyo_modal" style="display:none;"><div class="klaviyo_inner"><a href="#" class="klaviyo_close_modal klaviyo_header_close">&times;</a><form action="" method="POST" novalidate="novalidate" class="klaviyo_subscription_form"><input type="hidden" name="g" value="" /><p class="klaviyo_header"></p><p class="klaviyo_subheader"></p><div class="klaviyo_fieldset"></div><div class="klaviyo_fine_print"></div><div class="klaviyo_form_actions"><button type="submit" class="klaviyo_submit_button"><span></span></button></div><div class="klaviyo_below_submit"></div><div class="error_message" style="display:none;"></div></form><div class="success_message" style="display:none;"></div></div></div>',
"flyout.html": '<div class="klaviyo_flyout" style="display:none;"><div class="klaviyo_inner"><div class="klaviyo_topbar" /><a href="#" class="klav
@kwilczynski
kwilczynski / network.txt
Last active October 9, 2018 01:19
Amazon AWS - VPC network/subnet plan
VPC Network (CIDR) Designation Region
=== ============== =========== ======
1 10.100.0.0/16 Management Asia Pacific (Tokyo)
2 10.110.0.0/16 Production Asia Pacific (Tokyo)
3 10.120.0.0/16 Staging Asia Pacific (Tokyo)
Addressing scheme:
10.XXX.YYY.0/16
| `------ Subnet (e.g. Public and/or Private)
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

# Sends events to Flapjack for notification routing. See http://flapjack.io/
#
# This extension requires Flapjack >= 0.8.7 and Sensu >= 0.13.1
#
# In order for Flapjack to keep its entities up to date, it is necssary to set
# metric to "true" for each check that is using the flapjack handler extension.
#
# Here is an example of what the Sensu configuration for flapjack should
# look like, assuming your Flapjack's redis service is running on the
# same machine as the Sensu server:
@kennwhite
kennwhite / vpn_psk_bingo.md
Last active February 24, 2024 12:19
Most VPN Services are Terrible

Most VPN Services are Terrible

Short version: I strongly do not recommend using any of these providers. You are, of course, free to use whatever you like. My TL;DR advice: Roll your own and use Algo or Streisand. For messaging & voice, use Signal. For increased anonymity, use Tor for desktop (though recognize that doing so may actually put you at greater risk), and Onion Browser for mobile.

This mini-rant came on the heels of an interesting twitter discussion: https://twitter.com/kennwhite/status/591074055018582016

@ipedrazas
ipedrazas / knife cheat
Last active December 13, 2021 11:50
Hello!
# knife cheat
## Search Examples
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway