Instantly share code, notes, and snippets.

View zenoss_curl_examples.sh
#!/bin/sh
# Source this file
# Your Zenoss server settings.
ZENOSS_URL="http://localhost:8080"
ZENOSS_USERNAME="admin"
ZENOSS_PASSWORD="zenoss"
# Generic call to make Zenoss JSON API calls easier on the shell.
View gist:5470311
sub update_mongodb {
if (!Opts::option_is_set('noupdate')) {
my $client = MongoDB::MongoClient->new(host => $mongohost, port => $mongoport);
my $database = $client->get_database( $mongodatabase );
my $db = $database->get_collection( $mongocollection );
my $mongohash = \%hosthash;
my $mongoresult = $db->update({ "hostname" => $hosthash{'hostname'} }, $mongohash, { "upsert" => 1} );
print $mongoresult;
}
}
View gist:5595947
#keep or delete?
function kod()
{
ls -l $@
echo "Keep (k) or Delete (d)?"
read answer
if [ $answer == "k" ]; then
echo "Keeping. As you wish."
elif [ $answer == "d" ]; then
echo "DELETING $@"
View lighter-graphite-rpi.sh
#!/bin/bash
# A lighter graphite for raspberry pi/raspbian wheezy.
# For when you don't need memcache/rabbitmq/full uWSGI server/etc
# Not fully tested on a clean install. This is just what it *should* take.
# Installing supervisor because upstart conflicts with sysvinit
aptitude update && aptitude install gcc python-dev python-pip python-cairo python-pysqlite2 supervisor libffi-dev
pip install django==1.4.3
View gist:5681392
config t
stack disable
ip route 0.0.0.0 0.0.0.0 10.50.42.1
vlan 42
router-interface ve 42
int ve 42
ip address 10.50.42.xxx 255.255.255.0
end
wr mem
View gist:5809932
#!/usr/bin/env python
from optparse import OptionParser
from subprocess import Popen, PIPE
# Requires wmic from Samba project, or here:
# http://dev.zenoss.org/trac/browser/tags/zenoss-3.2.1/inst/externallibs
wmic = '/vagrant/wmic'
parser = OptionParser()
View gist:5960677
import hpilo
tempkey = {
2 : 'Temp 1',
3 : 'Temp 1',
4 : '01-Inlet Ambient'
}
def get_ambient_temp(host, username, password, ilo_version):
try:
View gist:6067761
# ~/.bashrc
export PROJECT_HOME=$HOME/Sandbox/venvs
export WORKON_HOME=$HOME/.venvs
source /usr/local/bin/virtualenvwrapper.sh
View gist:6068063
# ~/.bash_profile on OS X (though could be .bashrc on other OS's)
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
View gist:6068070
# Just basic syntax highlighting for vim
set nocompatible
syntax on
colo peachpuff