widgets/switchfield/views/widget.xml
<Alloy>
<TableViewRow id="container">
<Label id="label"/>
<Switch id="switchControl" onChange="change"/>
</TableViewRow>
</Alloy>| # Licensed under CC BY 3.0 http://creativecommons.org/licenses/by/3.0/ | |
| # Derived works must attribute https://gist.github.com/4492300 at the beginning, and the date. | |
| ################################################################## | |
| Installing and Configuring SmartOS on a budget server (with a /29) | |
| ################################################################## | |
| # if you find this gist useful, please star it | |
| # please be aware that budget hosting companies usually cut corners somewhere, |
widgets/switchfield/views/widget.xml
<Alloy>
<TableViewRow id="container">
<Label id="label"/>
<Switch id="switchControl" onChange="change"/>
</TableViewRow>
</Alloy>It is generally desirable to group all the hosts for a specific service into a single dashboard view. For example, all the web servers are in single view while all the database servers are in another view.
This is usually not an issue when you are sending custom metrics using Riemann client. However, there are cases where you are using something that you do not control how the metrics are being sent. i.e., Riemann-tools.
Since Riemann-tools scripts are application agnostic, in order for the dashboard view to group hosts, we must inject some application specific information into the tags field. Tags is a collection of arbitrary strings. In the case of Riemann-tools scripts you can pass in arbitrary strings on the command line.
riemann-health --host 127.0.0.1 --tag "prod" --tag "webserver"
| #!/usr/bin/env ruby | |
| #------------------------------------------------------------------------------ | |
| # Aggregate Print useful information from /proc/[pid]/smaps | |
| # | |
| # pss - Roughly the amount of memory that is "really" being used by the pid | |
| # swap - Amount of swap this process is currently using | |
| # | |
| # Reference: | |
| # http://www.mjmwired.net/kernel/Documentation/filesystems/proc.txt#361 |
Here's a preliminary experiment to see how much memory is saved with the new copy-on-write friendly (bitmap marking) GC.
Calculated by memstats.rb https://gist.github.com/kenn/5105061 on Debian x86_64.
# ./memstats.rb 20547
| private V8Function emit; | |
| private V8Function gnee; | |
| public FunctioncallModule() { | |
| super(); | |
| System.loadLibrary("functioncall-utils"); | |
| // create callback functions | |
| this.emit = new V8Function(createJSCallback("do_emit", "(Ljava/lang/Object;Ljava/lang/Object;)V")); |
| #!/usr/bin/env node | |
| // run with `node --expose-debug-as=Debug fileName.js` | |
| // traces all the code run after dummyFunc() invoked | |
| // see v8/src/debug-debugger.js for some of the impl of the API | |
| var debug = Debug.Debug | |
| //------------------------------------------------------------------------------ |
An addendum to CodeMirror's keyMap documentation, which unfortunately glosses over the 'connecting the wires' section.
CodeMirror.keyMap.tabSpace = {
Tab: function(cm) {
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
cm.replaceSelection(spaces, "end", "+input");
},
fallthrough: ['basic']
};| require 'httparty' | |
| require 'json' | |
| class Crashlytics | |
| include HTTParty | |
| base_uri 'https://api.crashlytics.com/api/v2' | |
| def session(email, password) | |
| self.class.post('/session.json', | |
| body: {email: email, password:password}.to_json, |
| #!/bin/pseudo-bash | |
| # Read through this and modify to taste. | |
| # Tested on: | |
| # image_uuid: bad2face-8738-11e2-ac72-0378d02f84de | |
| # smartos base64 1.9.0 | |
| # | |
| # jenkins is run as the "admin" user, with its home directory set to /home/admin/jenkins | |
| mkdir ~/jenkins |