Skip to content

Instantly share code, notes, and snippets.

View gist:5951363
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 Dec 14, 2015
Chef-Solo config doesn't match command line options. The following give me two different log outputs.
View solo.rb
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)
View gist:4488109
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 Oct 2, 2012
Example permission statement for AWS IAM group.
View gist:3819511
{
"Statement": [
{
"Sid": "[unique statement ID]",
"Action": [
"s3:*"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::your-bucket-name/*"
@jasonroelofs
jasonroelofs / gist:3695227
Created Sep 11, 2012
Request to Github: Fundamental missing piece of Notifications / Stars
View gist:3695227

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 Aug 16, 2012
default_scope is evil, EVIL!
View user.rb
] 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 Oct 5, 2015
raid.it test suite run times. Is your test suite this fast? https://github.com/jasonroelofs/raidit
View 2012-06-06.txt
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.
View driving.rb
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 Mar 9, 2012
Monit config for Resque run under Upstart
View resque.monitrc.erb
<% @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 Mar 6, 2012
Configure Upstart for Resque
View etc-init-resque.conf
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
You can’t perform that action at this time.