Skip to content

Instantly share code, notes, and snippets.

@jasonroelofs
jasonroelofs / gist:5951363
Created July 8, 2013 18:42
My current prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
parse_git_dirty () {
if [[ $((git status 2> /dev/null) | tail -n1) = "" ]]; then
echo ""
elif [[ $((git status 2> /dev/null) | tail -n1) != "nothing to commit (working directory clean)" ]]; then
echo "✗"
else
@jasonroelofs
jasonroelofs / solo.rb
Last active December 14, 2015 05:59
Chef-Solo config doesn't match command line options. The following give me two different log outputs.
The command line options give me exactly the log output I want, old Chef 10 with enough info and not too verbose. One line per action, no printing of the templates being rendered
$ chef-solo --force-logger --log_level info
...
[2013-02-26T15:54:06+00:00] INFO: Processing service[syslog-ng] action enable (syslog-ng::default line 30)
[2013-02-26T15:54:06+00:00] INFO: Processing service[syslog-ng] action start (syslog-ng::default line 30)
[2013-02-26T15:54:06+00:00] INFO: Processing package[logrotate] action upgrade (logrotate::default line 1)
[2013-02-26T15:54:06+00:00] INFO: Processing package[sudo] action upgrade (sudo::default line 1)
try_files
@cache
/maintenance.html
@passenger;
location @cache {
# Make sure we don't try to hit the cache files on POST or nginx
# will explode with a 405 Method Not Allowed
if ($request_method != GET) {
return 404;
@jasonroelofs
jasonroelofs / gist:3819511
Created October 2, 2012 14:22
Example permission statement for AWS IAM group.
{
"Statement": [
{
"Sid": "[unique statement ID]",
"Action": [
"s3:*"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::your-bucket-name/*"
@jasonroelofs
jasonroelofs / gist:3695227
Created September 11, 2012 01:06
Request to Github: Fundamental missing piece of Notifications / Stars

So here's the deal, Stars are great and all but the notifications rebuild has broken how I use Github on a daily basis. The following situation is now impossible:

  • I get the News Feed events NOT emails of repositories I'm watching
  • I get the News Feed events AND emails of my repositories

If I turn on "Email" for watching, then I get emails whenever a ticket is opened, or a comment is made, on say, Rubinius. I don't need or want that. But if I turn off "Email" and just have "Web" for watching, I no longer get emails when something happens to my repositories (like rice).

This is now the exact opposite of how I have been using Github, namely I want to keep up to date with the repositories I'm interested in following, and be notified of the things that are important to me. This is unfortunately now impossible.

Please fix this. I can't be the only one feeling this pain. We need to be able to send a given repository's event feed to our News Feed without getting emails.

@jasonroelofs
jasonroelofs / user.rb
Created August 16, 2012 15:19
default_scope is evil, EVIL!
] rails c
Loading development environment (Rails 3.2.8)
1.9.3p194 :001 > User.new
=> #<User id: nil, test_field: "Johnson">
@jasonroelofs
jasonroelofs / 2012-06-06.txt
Last active October 5, 2015 22:17
raid.it test suite run times. Is your test suite this fast? https://github.com/jasonroelofs/raidit
roelofs@Trillian:~/Development/raidit (master)
] time rake
Run options: --seed 45678
# Running [unit] tests:
.............SS.........................................S..S............S..S..........................
Fabulous tests in 0.018752s, 5439.4198 tests/s, 6985.9215 assertions/s.
class Driving
def start(car)
car.clone.merge(running: true)
end
def accelerate(car)
car.clone.merge(speed: car[:speed] + 1)
end
@jasonroelofs
jasonroelofs / resque.monitrc.erb
Created March 9, 2012 02:12
Monit config for Resque run under Upstart
<% @worker_count.times do |i| -%>
check process resque-<%= i -%> with pidfile <%= @project_root -%>/shared/pids/resque-<%= i -%>.pid
group resque
start program = "/sbin/start resque ID=<%= i -%>"
stop program = "/sbin/stop resque ID=<%= i -%>"
if changed pid 6 times within 6 cycles then stop
<% end %>
@jasonroelofs
jasonroelofs / etc-init-resque.conf
Created March 6, 2012 18:31
Configure Upstart for Resque
description "Resque worker configuration. Run with ID"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn
respawn limit 5 20
instance $ID