Skip to content

Instantly share code, notes, and snippets.

View itxx00's full-sized avatar
✈️
keep working

itxx00 itxx00

✈️
keep working
View GitHub Profile
@djoreilly
djoreilly / meta_svr.py
Last active May 17, 2023 08:04
Metadata server to allow booting cloud-init images on Libvirt
"""
Server to answer requests from Libvirt VMs to http://169.254.169.254/
Cloud images usually don't have a preset user/password, and this is needed to add a ssh pub key to .ssh/authorized_hosts.
Change SSH_PUB_KEY path below.
pip install bottle
sudo ip address add 169.254.169.254 dev virbr0
open firewall
-A ufw-user-input -s 192.168.122.0/24 -d 169.254.169.254/32 -i virbr0 -p tcp -m tcp --dport 80 -j ACCEPT
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@mr-jstraub
mr-jstraub / ambari_api_bulk_service_checks.md
Last active April 26, 2022 10:59
Ambari API - Run all Service Checks

#Ambari API - Run all Service Checks In order to check the status and stability of your cluster it makes sense to run the service checks that are included in Ambari. Usually each Ambari Service provides its own service check, but their might be services that wont include any service check at all. To run a service check you have to select the service (e.g. HDFS) in Ambari and click "Run Service Check" in the "Actions" dropdown menu.

Service Checks can be started via the Ambari API and it is also possible to start all available service checks with a single API command. To bulk run these checks it is necessary to use the same API/method that is used to trigger a rolling restart of Datanodes (request_schedules). The "request_schedules" API starts all defined commands in the specified order, its even possible to specify a pause between the commands.

Available Service Checks:

Service Name service_name Command
HDFS HDFS HDFS_SERVICE_CHECK
@laiwei
laiwei / 60_stats_per_cpu_core.py
Created June 30, 2015 09:48
open-falcon plugin stats per cpu core
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import time, os, socket
import json
metric = ['usr', 'nice', 'sys', 'idle', 'iowait', 'irq', 'soft', 'steal', 'guest']
host = socket.gethostname()
def get_cpu_core_stat(num):
@djblue
djblue / ssl.md
Last active August 29, 2015 14:10
nginx ssl

self signed ssl certificates

When setting up a development server that will be accessible over the internet, it is a good idea to use ssl.

Below are some snippets for setting up self signed certificates:

sudo openssl req -x509 -nodes -days 365 \
                 -newkey rsa:2048 \
 -keyout /etc/nginx/ssl/nginx.key \
@n0ts
n0ts / get_oracle_jdk_x64.sh
Last active September 16, 2023 12:07
Get latest Oracle JDK package bash shell script for linux/osx/windows
#!/bin/bash
# You must accept the Oracle JDK License Update
# https://www.oracle.com/java/technologies/javase-downloads.html
# usage: get_oracle_jdk_x64.sh <jdk_version> <platform> <ext>
# jdk_version: 14
# platform: linux or osx or windows
# ext: rpm or dmg or tar.gz or exec
jdk_version=${1:-14}
@ashrithr
ashrithr / graphite.md
Last active September 27, 2020 20:10
Installing graphite 0.10, collectd and grafana on centos 6

Installing Graphite:

Graphite does two things:

  1. Store numeric time-series data
  2. Render graphs of this data on demand

What Graphite does not do is collect data for you, however there are some tools out there that know

@vincentbernat
vincentbernat / 0001-EDNS0-client-subnet-support.patch
Last active March 11, 2020 14:36
EDNS0 client subnet support for BIND
From 83f0062d385fd4f111b31c1f26b571cabd7e0e4c Mon Sep 17 00:00:00 2001
From: Vincent Bernat <vincent.bernat@dailymotion.com>
Date: Thu, 5 Sep 2013 16:52:45 +0200
Subject: [PATCH] EDNS0 client subnet support.
---
bin/named/client.c | 227 +++++++++++++++++++++++++++++++--------
bin/named/include/named/client.h | 4 +
bin/named/include/named/server.h | 81 +++++++-------
bin/named/sortlist.c | 4 +-
@jpetazzo
jpetazzo / README.md
Last active August 21, 2019 17:55
Give network superpowers to docker

Unionize: network superpowers for your docker containers

Unionize lets you connect together docker containers in arbitrarily complex scenarios.

Note: I recommend to use https://github.com/jpetazzo/pipework instead.

  • pipework is a better name than unionize
  • it's hosted on a "real" github repo instead of a small gist :-)

Now if you want Unionize, it's still here. Just check those examples.

@caquino
caquino / nginx-config-example
Last active December 16, 2015 20:29
NGINX cache purge using cache_proxy_bypass
location / {
add_header X-Cached $upstream_cache_status;
....
proxy_cache_bypass $http_cache_purge;
....
proxy_pass ... ;
}