Skip to content

Instantly share code, notes, and snippets.

View dergachev's full-sized avatar

Alex Dergachev dergachev

View GitHub Profile
@dergachev
dergachev / prepend-timestamp.md
Last active September 28, 2016 14:56
shell snippet to prepend timestamp to command output

prepend-timestamp

Shell snippet that prepends a nice to a command's output.

For example, here's the (snipped) output of vagrant provision:

Successfully installed bundler-1.3.5  
1 gem installed  
Using rmagick (2.13.2)  
# prevents error: could not build the map_hash, you should increase map_hash_bucket_size: 64
map_hash_bucket_size 192;

map $http_user_agent $bad_bot {
        default 0;
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36" 1;
}

# must be in http context
@dergachev
dergachev / _nginx_dirty_debugging.md
Last active December 18, 2015 09:19
nginx dirty debugging trick

nginx dirty debugging

Like PHP's die() or ruby's raise, but for nginx config files.

Option 1, have external webservice to echo out the variable of interest:

rewrite ^ http://httpbin.org/get?abuse=$abuse last; break;
@dergachev
dergachev / _backbone-tutorial.md
Last active December 18, 2015 05:29
I made this gist in the course of experimenting with backbone.js.
@dergachev
dergachev / _snippet-embed.md
Last active December 18, 2015 05:19
Safely embedding code snippets in HTML.
@dergachev
dergachev / _onetab_export_markdown.bookmarklet.js
Created May 23, 2013 00:28
Onetab export format to gists;
// works on selected text
var selection = window.getSelection().toString();
if (selection) {
selection = selection.match(/[^\r\n]+/g)
.map(function(a) { return "* " + a; }).
join("\n");
prompt("Here's your markdown:", selection);
}

Notes from Promet Chef talk at Drupalcon Portland

@dergachev
dergachev / pantheon_monitoring_tools.md
Created May 22, 2013 21:30
Kyle monitoring tools: sensu, graphite, statsd

This is what they use.