This file contains hidden or 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
| #!/usr/bin/env python | |
| # pylint: disable=invalid-name | |
| # http://www.redmine.org/projects/redmine/wiki/Rest_api | |
| # author: guido | |
| import argparse | |
| import json | |
| import os | |
| import urllib |
This file contains hidden or 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
| - name: Release chaos monkey | |
| hosts: localhost | |
| gather_facts: true | |
| connection: local | |
| vars: | |
| probability: 5 | |
| tasks: | |
| - name: Kill random instances belonging to hostgroups with multiple instances | |
| os_server: |
This file contains hidden or 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
| public void uploadImage(byte[] data, int width, int height) { | |
| final Context context = contextWeakReference.get(); | |
| YuvImage yuvimage = new YuvImage(data, ImageFormat.NV21, width, height, null); | |
| try { | |
| final File outputFile = FileUtils.createExternalFile(Environment.DIRECTORY_DCIM, ".jpeg"); | |
| final BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(outputFile)); | |
| yuvimage.compressToJpeg(new Rect(0, 0, width, height), 90, os); // compress level = 90 |
This file contains hidden or 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
| import java.util.Map; | |
| import org.elasticsearch.storm.EsBolt; | |
| import backtype.storm.task.IOutputCollector; | |
| import backtype.storm.task.OutputCollector; | |
| import backtype.storm.task.TopologyContext; | |
| import backtype.storm.tuple.Tuple; | |
| public class ExtendedESBolt extends EsBolt { |
This file contains hidden or 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
| module['exports'] = function echoHttp (hook) { | |
| console.log(hook.params); | |
| console.log(hook.req.path); | |
| console.log(hook.req.method); | |
| console.log(hook.env); | |
| hook.res.end(JSON.stringify(hook.params, true, 2)); | |
| }; |
This file contains hidden or 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
| git pull --rebase origin master | |
| git rebase -i origin/master | |
| -- | |
| git commit --amend --no-ff |
This file contains hidden or 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
| module['exports'] = function tokbox(hook) { | |
| var request = require('request'); | |
| // The parameters passed in via the slash command POST request. | |
| var params = hook.params; | |
| console.log(JSON.stringify(params)); | |
| // Check that the hook has been triggered from our slash command by | |
| // matching the token against the one in our environment variables. | |
| if (params.token !== hook.env.tokbox_command_token) { |
This file contains hidden or 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
| module['exports'] = function getExternalIp(hook) { | |
| var store = hook.datastore; | |
| store.get('externalip', function(err, result) { | |
| if (err) { | |
| return res.end(err.message); | |
| } | |
| hook.res.write(JSON.stringify(result)); | |
| hook.res.end(); | |
| }); | |
| }; |
This file contains hidden or 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
| module['exports'] = function saveExternalIp (hook) { | |
| var params = hook.params; | |
| var store = hook.datastore; | |
| var obj = { ip: params.ip, date: new Date() }; | |
| store.set('externalip', obj, function(err, result) { | |
| if (err) { | |
| return res.end(err.message); | |
| } | |
| // See http://hook.io/docs#data for more information |
This file contains hidden or 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
| MONGO_LOG %{SYSLOGTIMESTAMP:timestamp} \[%{WORD:component}\] %{GREEDYDATA:message} | |
| MONGO_QUERY \{ (?<={ ).*(?= } ntoreturn:) \} | |
| MONGO_SLOWQUERY %{WORD} %{MONGO_WORDDASH:database}\.%{MONGO_WORDDASH:collection} %{WORD}: %{MONGO_QUERY:query} %{WORD}:%{NONNEGINT:ntoreturn} %{WORD}:%{NONNEGINT:ntoskip} %{WORD}:%{NONNEGINT:nscanned}.*nreturned:%{NONNEGINT:nreturned}..+ (?<duration>[0-9]+)ms | |
| MONGO_WORDDASH \b[\w-]+\b | |
| MONGO3_SEVERITY \w | |
| MONGO3_COMPONENT %{WORD}|- | |
| MONGO3_LOG %{TIMESTAMP_ISO8601:timestamp} %{MONGO3_SEVERITY:severity} %{MONGO3_COMPONENT:component}%{SPACE}(?:\[%{DATA:context}\])? %{GREEDYDATA:message} |