Instantly share code, notes, and snippets.

View pgbouncer.rb
class PgbouncerStats < Scout::Plugin
# need the ruby-pg gem
needs 'pg'
OPTIONS=<<-EOS
user:
name: Pgbouncer username
notes: Specify the username to connect with
password:
name: Pgbouncer password
View time-series-ring-buffer.js
var TimeSeriesRingBuffer = function(size) {
this._lastTS = 0;
this._size = size;
this.reset();
};
TimeSeriesRingBuffer.prototype.reset = function(){
this._buffer = new Array(this._size);
for (var i = 0; i < this._size; i++) {
this._buffer[i] = 0;
View gist:7728286
find -type f -printf '%T+ %p\n' | sort -r | head -1
View responses.rst
import responses

@responses.activate
def test_my_api():
    responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
                  body='{"error": "not found"}', status=404,
                  content_type='application/json')
View gist:7330744
# supervisor
[sentry]
numprocs=10
command=uwsgi --addr=0.0.0.0:90%(process_num)02d
# when you restart it does them in batches, instead of one at a time
$ sudo supervisorctl restart sentry
- stops all 10 procs
View gist:6775018
var Changes = angular.module('Changes', ['ngAnimate', 'ngRoute']).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'partials/change-list.html',
resolve: {
initialData: function($http) {
return $http.get('/api/0/changes/');
}
},
View gist:6774625
<section ng-controller="ChangeListCtrl">
<table class="change-list table table-striped">
<tbody>
<tr class="status-{{change.lastBuild.status.id}} result-{{change.lastBuild.result.id}}"
ng-repeat="change in changes | orderBy:dateModified:true" ng-animate="'animate-fade'">
<td>
<div class="indicator" title="{{change.lastBuild.result.name}}">
<div data-result="{{change.lastBuild.result.id}}"
data-value="{{change.lastBuild.progress}}" ng-radial-progress-bar>&nbsp;</div>
</div>
View gist:6682862
dcramer:buildbox in ~/Development/buildbox on git:master
$ python -m timeit '(True and "pass")'
10000000 loops, best of 3: 0.0512 usec per loop
dcramer:buildbox in ~/Development/buildbox on git:master
$ python -m timeit '(True and "pass")'
10000000 loops, best of 3: 0.049 usec per loop
dcramer:buildbox in ~/Development/buildbox on git:master
$ python -m timeit '(True and "pass")'
View gist:6568624
$ pip install --help
Usage:
pip install [options] <requirement specifier> ...
pip install [options] -r <requirements file> ...
pip install [options] [-e] <vcs project url> ...
pip install [options] [-e] <local project path> ...
pip install [options] <archive url/path> ...
Description:
View gist:6457463
Jenkins EC2 plugin should not re-render sensitive values:
- access key
- secret key
- private key