This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check process elasticsearch with pidfile /var/run/elasticsearch.pid | |
start program = "/etc/init.d/elasticsearch start" | |
stop program = "/etc/init.d/elasticsearch stop" | |
if 5 restarts within 5 cycles then timeout | |
if failed host 127.0.0.1 port 9200 protocol http then restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getOutputResolution(max_width, max_height, videoInfo) { | |
var tmp_max_width = 0 | |
var tmp_max_height = 0 | |
// ShrinkToFit: don't scale up videos | |
max_width = (max_width > videoInfo.width) ? videoInfo.width : max_width | |
max_height = (max_height > videoInfo.height) ? videoInfo.height : max_height | |
if (videoInfo.width < videoInfo.height) { // for portrait | |
tmp_max_width = Math.min(max_width, max_height) // getting the smallest number for width | |
tmp_max_height = Math.max(max_width, max_height) // getting the biggest number for height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"title-suggest": { | |
"type": "completion", | |
"analyzer": "simple", | |
"payloads": false, | |
"preserve_separators": true, | |
"preserve_position_increments": true, | |
"max_input_length": 30 | |
}, | |
"name-suggest": { | |
"type": "completion", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This scripts scans the elasticsearch source code for all the registered REST endpoints | |
# It will put the formatted output in $DEFINITIONOUTPUTFILE | |
# [MethodName] [HttpVerb] [Route] | |
ESFOLDER="../elasticsearch" | |
DEFINITIONOUTPUTFILE="src/Generated/rest-actions.txt" | |
# Find all the lines that registerHandlers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--- | |
# iPIN - iPhone PNG Images Normalizer v1.0 | |
# Copyright (C) 2007 | |
# | |
# Author: | |
# Axel E. Brzostowski | |
# http://www.axelbrz.com.ar/ | |
# axelbrz@gmail.com | |
# | |
# References: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Helper method to fix Apple's stupid png optimizations | |
# Adapted from: | |
# http://www.axelbrz.com.ar/?mod=iphone-png-images-normalizer | |
# https://github.com/peperzaken/iPhone-optimized-PNG-reverse-script/blob/master/Peperzaken/Ios/DecodeImage.php | |
# PNG spec: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html | |
require 'zlib' | |
require 'logger' | |
module PNG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create a web friendly URL slug from a string. | |
* | |
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support. | |
* | |
* Although supported, transliteration is discouraged because | |
* 1) most web browsers support UTF-8 characters in URLs | |
* 2) transliteration causes a loss of information | |
* | |
* @author Sean Murphy <sean@iamseanmurphy.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AWS = require('aws-sdk'); | |
AWS.config.update({ | |
accessKeyId: '{AWS_KEY}', | |
secretAccessKey: '{AWS_SECRET}', | |
region: '{SNS_REGION}' | |
}); | |
var sns = new AWS.SNS(); |