Skip to content

Instantly share code, notes, and snippets.

View todgru's full-sized avatar

todgru

  • Portland, OR
View GitHub Profile
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@todgru
todgru / cron
Created May 27, 2015 15:49
Running rake file dependand on environment variables
# having env.sh in /etc/profile.d allows access to all users...be careful
*/5 * * * * . /etc/profile.d/env.sh && cd /opt/path && /home/ubuntu/.rbenv/shims/bundle exec rake task
@todgru
todgru / Bcrypt.php
Created September 7, 2012 22:52
Simple PHP 5.3+ Bcrypt class and functions php bcrypt
<?php
/*
By Marco Arment <me@marco.org>.
This code is released in the public domain.
THERE IS ABSOLUTELY NO WARRANTY.
Usage example:
// In a registration or password-change form:
@todgru
todgru / bash_osx_notes.md
Created November 19, 2012 21:21
BASH OSX notes bash osx

Order of execution in OSX:

/etc/profile
~/.bash_profile
~/.bashrc
~/.bash_login
~/.profile
~/.bash_logout
@todgru
todgru / modules.md
Last active October 13, 2015 01:08
Git submodule

#Submodules

Here is how we do it at Our Office


When you clone your working repos (api, app, www), you'll have an empty Modules directory. The working repo will contain a pointer to the hash of the last Modules repo committed. All that needs to be done from your working repo directory is:

$ git subumodule init
@todgru
todgru / Here_is_why.md
Created November 26, 2012 21:47
Ruby, Bundler, rvm and gems can be bitches

#The Big Headache.

A common error we get when attempting to run rake -T after a git pull is:

rake aborted!
cannot load such file -- some/gem_file
/Users/todgru/.rvm/gems/ruby-1.9.3-p194/gems/vlad-2.3.0/lib/vlad.rb:3:in `require'
/Users/todgru/.rvm/gems/ruby-1.9.3-p194/gems/vlad-2.3.0/lib/vlad.rb:3:in `<top (required)>'
/Users/todgru/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.2/lib/bundler/runtime.rb:68:in `require'

/Users/todgru/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.2/lib/bundler/runtime.rb:68:in `block (2 levels) in require'

@todgru
todgru / how_to_back_out_a_commit.md
Created December 10, 2012 18:58
oops git reverse commit back out

#Oops, I merged untested changes to master!

You've made changes to master, commited and push up to your repo. Git is flexible enough that you can dig yourself out rather easily. Here are two of many options to get back to a safe place.

  • Option 1, Branch out and keep your changes.
  • Option 2, Reset the branch and lose changes.

The final step in both of these options is $ git push --force origin master.

##Option 1: Branch Out

@todgru
todgru / how_to_use_pull_request.md
Created December 11, 2012 18:31
How to use git pull request

#How to use Pull Request

From https://help.github.com/articles/using-pull-requests

After you have branched from the mainline, made changes, commit to your branch and push your branch to the Github repo.

In the Github repo, select your branch from the drop down.

Click pull request......

@todgru
todgru / disk.md
Created November 17, 2015 19:34
Ubuntu disk use integer

perc=$(df -h |grep /dev/xvda1| awk {'print $5'}); echo ${perc::-1}