Skip to content

Instantly share code, notes, and snippets.

@emedvedev
emedvedev / ack.js
Last active Nov 30, 2015
ChatOps acknowledgement context in StackStorm
View ack.js
{
"actionalias": {
"uid": "action:chatops:get",
"ack": {
"format": "Got {{ execution.parameters.thing }}"
},
"enabled": true,
"name": "get",
"result": {
"enabled": false
@emedvedev
emedvedev / 1.2.0.md
Last active Dec 10, 2015
StackStorm 1.2.0 release notes draft
View 1.2.0.md

StackStorm 1.2.0: the new ChatOps

ChatOps — a concept where a chat bot acts as a control plane for your operations — has always been a core part of StackStorm. It adds context to your actions, automates routine tasks nobody likes, helps team members communicate better and learn from each other, and sometimes it's just plain fun. If you're new to this, check out the DevOps Next Steps talk by James Fryman, and if you've been writing Eggdrop scripts in IRC since you were five but never used it in your daily operations, you might also get inspired from the ChatOps at GitHub talk by Jesse Newland.

Today, we're all excited to introduce — as a part of our 1.2.0 release — a completely revamped ChatOps feature list. If you're already using our Hubot integration to execute StackStorm actions from chat, stop doing whatever it is you're doi

View Dropbox upstart
description "Dropbox"
author "emedvedev"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid root
env LANG="en_US.UTF-8"
View arbitrarybase.py
import string
class BaseNumber():
def __init__(self, number=None, numerator=None, denominator=None):
if numerator and denominator:
self.numerator = int(numerator)
self.denominator = int(denominator)
elif number:
self.num = float(number)
View chatops_parser.py
import re
def parse(template, string):
result = {}
# getting a full list of params with their default values if present
params_list = re.findall(r'{{\s*(.+?)\s*(?:=(.+?))?\s*}}', template)
View index.cgi
#!/usr/bin/ruby
require 'cgi'
cgi = CGI::new
program = cgi['program']
result = ""
message = ""
unless program != ""
message = ""
View PNG
iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY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hIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjUtYzAyMSA3OS4xNTU3NzIsIDIwMTQvMDEvMTMtMTk6NDQ6MDAgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE0IE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpBQzNBQzhFMDNFN0MxMUU1OTFGMjhGRjIxNjJGQTAyRiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo1NDU2RTI1QzNFN0QxMUU1OTFGMjhGRjIxNjJGQTAyRiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkFDM0FDOERFM0U3QzExRTU5MUYyOEZGMjE2MkZBMDJGIiBzdFJlZjpkb2N1
View gist:8045940
@emedvedev
emedvedev / gist:6015742
Created Jul 16, 2013
Brackets image preview extension
View gist:6015742
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global define, $, brackets, window */
/* Simple extension that opens images for preview instead of showing the error modal. */
define(function (require, exports, module) {
"use strict";
/* Sadly enough, this is the only line of code utilizing
* Brackets' architecture in the right way. */
var Strings = brackets.getModule("strings");