Skip to content

Instantly share code, notes, and snippets.

View ryanlelek's full-sized avatar
🔮
Like Magic

Ryan Lelek ryanlelek

🔮
Like Magic
View GitHub Profile
<?PHP
/**
* pingdom.php
*
* This application will check your server swap, hard drive, cpu, and MySQL conditions.
* It will then generate an appropriate XML file for a Pingdom HTTP Custom check.
*
* If any usage is above your preset thresholds, then a down message will be returned,
* indicating that your server may be under more load than usual, hopefully, providing
* a bit of advanced notice before a true failure due to lack of resources
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@ryanlelek
ryanlelek / cpu.js
Last active October 28, 2024 22:00 — forked from bag-man/cpu.js
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores
@ryanlelek
ryanlelek / benchmark.sh
Created December 2, 2014 15:22
Benchmark
#!/bin/bash
# Modified from http://www.shellhacks.com/en/Check-a-Website-Response-Time-from-the-Linux-Command-Line
curl -s -w '\nLookup:\t%{time_namelookup}\nConnect:\t%{time_connect}\nApp Connect:\t%{time_appconnect}\nRedirect:\t%{time_redirect}\nPretransfer:\t%{time_pretransfer}\nStarttransfer:\t%{time_starttransfer}\n\nTotal:\t%{time_total}\n' -o /dev/null {$1};
@ryanlelek
ryanlelek / javascript_cdns.txt
Created August 28, 2014 06:58
JavaScript CDNs
//ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js
//code.jquery.com/jquery.min.js
//getbootstrap.com/dist/js/bootstrap.js
//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css
@ryanlelek
ryanlelek / bootstrap_centered.html
Created August 28, 2014 06:11
Bootstrap Centered Jumbotron
<!DOCTYPE html>
<html>
<head>
<!-- Credit: http://stackoverflow.com/questions/22196587/how-to-center-align-vertically-the-container-in-bootstrap -->
<title>Bootstrap Centered Jumbotron</title>
<meta charset="utf-8" />
<link type="text/css" rel="stylesheet" href="http://getbootstrap.com/dist/css/bootstrap.css" />
<style type="text/css">
@ryanlelek
ryanlelek / install.sh
Last active August 29, 2015 14:05
JSON Print Script
curl -o /usr/local/bin/prettyjson https://gist.githubusercontent.com/ryanlelek/78fc643886628e454a56/raw/12380b8ab13b9c23e1c34c9fe996c01e40b2eccb/prettyjson.py; chmod +x /usr/local/bin/prettyjson;
@ryanlelek
ryanlelek / SublimeSettings.json
Last active August 29, 2015 14:01
Sublime Settings
{
"auto_complete": false,
"auto_match_enabled": false,
"color_scheme": "Packages/Color Scheme - Default/Blackboard.tmTheme",
"draw_white_space": "all",
"font_size": 21,
"highlight_modified_tabs": true,
"line_numbers": true,
"open_files_in_new_window": false,
"preview_on_click": false,
'use strict';
// Modules
var request = require('request');
// Variables
var settings = {
host : 'http://localhost:8443',
version : 'v0',
verifySSL : false,
'use strict';
// I'd strongly recommend not using Socket.io rooms
// This will make it more difficult to switch to another
// WebSocket library that may not support rooms (SockJS?)
// You can use Redis or another data store to create rooms and add/remove users
// But, here it is for historical and educational purposes
// Socket.IO v0.7 now gives you one Socket per namespace you define: