Skip to content

Instantly share code, notes, and snippets.

@jalons
jalons / 0_reuse_code.js
Created July 2, 2016 02:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jalons
jalons / graphite.md
Created November 23, 2015 15:40 — forked from ashrithr/graphite.md
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

@jalons
jalons / Documentation.md
Last active August 29, 2015 14:27 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
git config --global alias.cowsay '!git commit -m "`fortune | cowsay -f tux`"'
reactor:
- 'salt/minion/*/start':
- /srv/reactor/sync_all.sls
- /srv/reactor/graphite_event.sls
# This uses the grains module
# http://docs.saltstack.org/en/latest/ref/modules/all/salt.modules.grains.html#module-salt.modules.grains
# http://salt.readthedocs.org/en/latest/ref/states/all/salt.states.module.html#module-salt.states.module
salt:
module.run:
- name: grains.ls
@jalons
jalons / cloud.sls
Created March 20, 2013 19:05 — forked from auser/cloud.sls
#!py
import pprint
import yaml
space_character = " "
def run():
'''
Print the config files
'''
t = {
@jalons
jalons / subprocess_timeout.py
Created July 10, 2012 22:05 — forked from kirpit/bash.py
Enables to run subprocess commands in a different thread with TIMEOUT option!
class Command(object):
'''
Enables to run subprocess commands in a different thread
with TIMEOUT option!
Based on jcollado's solution:
http://stackoverflow.com/questions/1191374/subprocess-with-timeout/4825933#4825933
'''
def __init__(self, cmd):
self.cmd = cmd
@jalons
jalons / functions.js
Created May 22, 2012 01:10 — forked from RedBeard0531/functions.js
Min, Max, Sum, Count, Avg, and Std deviation using MongoDB MapReduce
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
function map() {
emit(1, // Or put a GROUP BY key here
{sum: this.value, // the field you want stats for
min: this.value,
max: this.value,
count:1,
diff: 0, // M2,n: sum((val-mean)^2)
});