Skip to content

Instantly share code, notes, and snippets.

View SEJeff's full-sized avatar

Jeff Schroeder SEJeff

View GitHub Profile
@whiteinge
whiteinge / salt-lowdata-formats.rst
Last active January 7, 2023 17:21
Salt is used to execute functions across a wide variety of locations in a wide variety of ways. It does this by mapping the function name and function parameters within a data structure (JSON-serializable). Unfortunately, there is a variety of formats in different parts of Salt for doing so.

Various formats of mapping data to function calls in Salt

Note

Legend

mod

Module name

fun

Function name (in module)

@SeonghoonKim
SeonghoonKim / apache-balancer.sh
Last active March 8, 2022 08:12
Apache HTTPD balancer-manager control script
#! /bin/sh
# Set up a default search path
PATH="/usr/bin:/bin"
CURL=`which curl`
if [ -z "$CURL" ]; then
echo "curl not found"
exit 1
fi
@jordansissel
jordansissel / RESULTS.md
Created September 21, 2012 07:41
screenshot + code showing how to query logstash/elasticsearch with a graphite function.

logstash queries graphed with graphite.

Operation: Decouple whisper from graphite.

Method: Create a graphite function that does a date histogram facet query against elasticsearch for a given query string for the time period viewed in the current graph.

Reason: graphite has some awesome math functions. Wouldn't it be cool if we could use those on logstash results?

The screenshot below is using logstash to watch the twitter stream of keywords "iphone" "apple" and "samsung" - then I graph them each, so we get an idea of popularity. As a bonus, I also do a movingAverage() on the iphone curve to show you why this is awesome.

@wofeiwo
wofeiwo / gist:3634357
Created September 5, 2012 10:00
Golang daemonize
/* ivan(a.t)mysqlab.net */
package main
import (
"syscall"
"os"
"log"
)
func daemon(nochdir, noclose int) int {
@rduplain
rduplain / README.md
Created August 30, 2012 16:07
Flask-Script: demo passing in configuration file.

This demonstrates that you can configure a Flask application through Flask-Script, without having to create a Flask instance or deal with circular dependencies. Note that Flask-Script's Manager accepts a factory function in place of a Flask app object.

Running:

python manage.py runserver

gives "Hello, world!" on http://localhost:5000/, while running:

python manage.py runserver -c development.cfg
@nf
nf / hello-node.js
Created July 6, 2012 21:14
Hello world web server that scales across multiple processors
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
cluster.on('exit', function(worker, code, signal) {
@commandodev
commandodev / req_req.py
Created June 26, 2012 10:04
Handling REQ/REP syncronization in eventlet
from eventlet.pools import Pool
from eventlet.timeout import Timeout
class SocketPool(Pool):
"""A pool of sockets connected to a component
If a socket times out in use, simply close if before handing it back to the
pool and it will be discarded and a replacement inserted into the pool."""
def __init__(self, address, **kwargs):
@wickman
wickman / README.md
Created April 12, 2012 22:55
Python development in Pants (tutorial)

Python development using Pants

brian wickman - @wickman

[TOC]

Why use Pants for Python development?

Pants makes the manipulation and distribution of hermetically sealed Python environments

@fatbox
fatbox / djangomodule.py
Created January 28, 2012 14:22
Load Django modules from within a Salt module
"""
This allows you to import Django modules into a Salt module
"""
import logging
import sys
import os
log = logging.getLogger(__name__)
@drawks
drawks / gist:1556276
Created January 3, 2012 18:47 — forked from kimchy/gist:1556146
Enable _source compression in elasticsearch
curl -XPUT 'http://localhost:9200/_template/template_logstash/' -d '
{
"template": "logstash-*",
"mappings": {
"_default_": {
"_source": { "compress": "true" },
}
}
}'