Skip to content

Instantly share code, notes, and snippets.

View jobwat's full-sized avatar

Jo Boiteau jobwat

  • Servian
  • Sydney
View GitHub Profile
Dir.chdir "/home/vagrant/app"
logs = `git log --pretty 1.2.0..1.2.1 | grep -E "(T ?M[-_ ]?[0-9]+|T ?T[-_ ]?[0-9]+)"`
labels = logs.each_line.map do |line|
line.scan(/T ?[TM][-_ ]?[0-9]+/i).map do |s|
s.upcase.gsub(/T ?([TM])[^\d]?(\d+)/, 'T\1-\2')
end
end
final_list = labels.sort.uniq{|s|s.first}
#!/bin/bash
# inspired from: https://gist.github.com/vitobotta/2783513
threshold=300 # after 5min of uptime, a job is considered 'stuck', to kill
logfile=log/dead_workers_killed.log
function ps_etime_to_seconds() # cheers user000001 - http://stackoverflow.com/questions/14652445/parse-ps-etime-output-into-seconds#14653443
{
echo $1 | awk -F $':' -f <(cat - <<-'EOF'
@jobwat
jobwat / helper.js
Created June 7, 2011 00:13
Dynamic resize element text font-size to fit parent element width
Helpers.updateResizeInput = function(el, text){
if(el[0].localName == "input"){ // inputs are a pain (width auto is wrong & innerHTML <> value)
if(text==undefined) text = el[0].value;
el.parent().prepend('<span id="test" />');
var theSpan = $('span#test', el.parent());
theSpan.value = text;
Helpers.updateResizeInput(theSpan, text);
el.css('font-size', theSpan.css('font-size'));
el.css('margin-top', theSpan.css('margin-top'));
el[0].value = text;