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/sbin/dtrace -s | |
syscall::read:entry | |
/execname == "sh" || execname == "ksh" || execname == "csh" || | |
execname == "tcsh" || execname == "zsh" || execname == "bash"/ | |
{ | |
self->start = timestamp; | |
self->buf = arg1; | |
self->len = arg2; | |
} |
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
# prerequisites: curl, jq (brew install jq), openssl | |
echo "To:" | |
read EMAIL | |
# retrieve user info (login+ssh key) from github | |
LOGIN=`curl -s https://api.github.com/search/users?q=$LOGIN | jq -r '.items[0].login'` | |
KEY=`curl -s https://api.github.com/users/$LOGIN/keys | jq -r '.[0].key'` | |
echo $KEY > $LOGIN.pub |
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} |
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
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 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
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 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
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
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 |