Skip to content

Instantly share code, notes, and snippets.

# Put this in nrpe.cfg on the remote host you're monitoring.
command[check_load]=/usr/local/nagios/libexec/check_load -w 5,4,3 -c 10,8,6
command[check_memory]=/usr/local/nagios/libexec/check_mem.pl -f -w 5 -c 2
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
@touv
touv / app
Created October 28, 2011 08:16
LSB launcher for express of nodejs
#! /bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@nogood3
nogood3 / CPU_Bench.py
Created January 23, 2012 17:27
PYthon CPU Benchmark (GTK)
#!/usr/bin/python
# coding: utf-8
import pygtk
pygtk.require('2.0')
import gtk
import time
import os
import ru
@sasha-id
sasha-id / README
Created March 23, 2012 15:03
MongoDB multiple instance upstart scripts: mongodb, mongod --configsvr and mongos
MongoDB upstart scripts for Ubuntu.
Run following commands after installing upstart scripts:
ln -s /lib/init/upstart-job /etc/init.d/mongoconf
ln -s /lib/init/upstart-job /etc/init.d/mongodb
ln -s /lib/init/upstart-job /etc/init.d/mongos
To start services use:
@asimihsan
asimihsan / gist:2266588
Created March 31, 2012 16:35
python retry decorator
import pymongo.errors
# Retry decorator with exponential backoff
def retry(tries=5, delay=0.1, backoff=2):
"""Retries a function or method until it returns True.
delay sets the initial delay in seconds, and backoff sets the factor by which
the delay should lengthen after each failure. backoff must be greater than 1,
or else it isn't really a backoff. tries must be at least 0, and delay
greater than 0.
@chandsie
chandsie / search.js
Created January 3, 2013 05:17
YouTube Search Autocomplete Example
var suggestCallBack; // global var for autocomplete jsonp
$(document).ready(function () {
$("#search").autocomplete({
source: function(request, response) {
$.getJSON("http://suggestqueries.google.com/complete/search?callback=?",
{
"hl":"en", // Language
"ds":"yt", // Restrict lookup to youtube
"jsonp":"suggestCallBack", // jsonp callback function name
@nicolashery
nicolashery / mongoose-paginate.js
Last active January 24, 2018 13:02 — forked from craftgear/mongoose_paginate.coffee
Mongoose Paginate plugin
/* Mongoose Paginate plugin
Forked from:
https://gist.github.com/craftgear/1525918
This snippet is inspired by edwardhotchkiss's mongoose-paginate
(https://github.com/edwardhotchkiss/mongoose-paginate)
and works with any methods like where, desc, populate, etc.
The `paginate` method must be called at the end of method chains.
@miglen
miglen / Apache Tomcat 8 Start stop script init.d script
Last active November 10, 2022 20:03 — forked from valotas/tomcat.sh
Apache Tomcat init script (or startup/controll script). Works fine for version 7/8. Read the comments for release history. Feel free to modify, copy and give suggestions. (c) GNU General Public License
#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active July 10, 2024 14:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@zeroSteiner
zeroSteiner / rdesktop-gui
Last active January 24, 2024 20:28
Python rdesktop GUI
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# rdesktop-gui
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright