Skip to content

Instantly share code, notes, and snippets.

View pivotal-casebook's full-sized avatar

pivotal-casebook

View GitHub Profile
@pivotal-casebook
pivotal-casebook / most_recent_reopening.rb
Last active August 29, 2015 14:27
Refactoring: replace assessment#reopened_at with query via WorkflowEvent.most_recent_reopening #100672128
05b794c 2015-08-13 12:09:32 -0400 Chris Earnhardt and Mitch Saltykov | WIP - Chris stuff!
diff --git a/app/models/assessment.rb b/app/models/assessment.rb
index 00932ca..cfa66e6 100644
--- a/app/models/assessment.rb
+++ b/app/models/assessment.rb
@@ -744,13 +744,18 @@ class Assessment < ActiveRecord::Base
end
def has_been_appended?
- reopened_at?
@pivotal-casebook
pivotal-casebook / data-presents-example.js
Created February 13, 2015 19:25
data-presents old vs. new style
// Given this HTML:
// <div data-presents='foobar'></div>
// Old style
// Usually written by passing org.casebook.views
// to an anonymous function as `ns`.
org.casebook.views('foobar', {
initialize: function() {
var el = this
},
Pivotal Tracker: in a story's History view, replace the timestamps (e.g., "3 hours ago", "Jan. 1") with full-precision ones (e.g., "1 Jan 2014, 12:34pm").
$("span[data-millis]").each(function(index) { $(this).html($(this).parent('span').attr('title'));})
@pivotal-casebook
pivotal-casebook / gist:7529232
Created November 18, 2013 15:03
can't traceroute DR->production
deploy@dr-logging-1|dr /var/log $ traceroute 10.42.36.155
traceroute to 10.42.36.155 (10.42.36.155), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
@pivotal-casebook
pivotal-casebook / gist:7475313
Last active December 28, 2015 08:59
Logstash says address already in use but no evidence that is the case?
[root@splunk ~]# lsof -i -P | grep 5043
[root@splunk ~]#
[root@splunk ~]# cat /opt/logstash/server/etc/conf.d/logstash.conf
input {
lumberjack {
port => 5043
ssl_certificate => "/etc/ssl/logstash.pub"
ssl_key => "/etc/ssl/logstash.key"
@pivotal-casebook
pivotal-casebook / example output
Created September 14, 2012 15:20
A shell script which outputs all git branches on origin, sorted by the most recent commit, and shows authors of those commits
metropolitan:casebook2 (master) $ script/show-branch-info
Pruning origin
URL: git@github.com:casebook/casebook2.git
* [pruned] origin/old_branch_1
* [pruned] origin/old_branch_2
2012-09-14 11:09:29 -0400 12 minutes ago John Doe origin/master
2012-09-14 11:09:29 -0400 12 minutes ago John Doe origin/HEAD
2012-09-14 09:48:47 -0400 2 hours ago Jane Doe origin/topic_branch_1
2012-09-14 09:48:14 -0400 2 hours ago Jimmy Doe origin/production_branch
@pivotal-casebook
pivotal-casebook / gist:3251389
Created August 3, 2012 20:50
Find all attachment ids for failed RecreateThumbnailJob jobs in resque
$('a.backtrace').map(function(){
var t = $(this).text();
if (/^Interrupted system call/.test(t)){
return parseInt(t.split(' ')[6].split('/')[9]);
}
})
@pivotal-casebook
pivotal-casebook / subdir_file_count.sh
Created July 13, 2012 15:53
List number of files in subdirectories individually
for d in $(find . -type d -print0 | xargs -0); do printf '%d\t%s\n' $(find "$d" -type f | wc -l) "$d"; done
#!/bin/bash
echo -e "kern.sysv.shmmax=6442450944\nkern.sysv.shmmin=1\nkern.sysv.shmmni=256\nkern.sysv.shmseg=64\nkern.sysv.shmall=393216" > /etc/sysctl.conf
reboot
exit
sysctl -w kern.sysv.shmmax=6442450944
sysctl -w kern.sysv.shmmin=1
sysctl -w kern.sysv.shmseg=64
sysctl -w kern.sysv.shmall=393216