Skip to content

Instantly share code, notes, and snippets.

@Draiken
Draiken / Git.txt
Created April 20, 2011 17:51
Comandos do git
git status
# mostra o status de tudo, o que foi alterado, o que foi criado, o que foi deletado
git add <arquivo>
# adiciona o arquivo para ser tracked pelo git
git add -A
@Draiken
Draiken / post-receive.json
Created June 28, 2011 13:31
json generated from post-receive
{
:before=>"9e46da9a352aefeeefc4344de5ab2b513fc33716",
:repository=>{:name=>"test"},
:after=>"65cbbc08b054b8e9626b20d81fdaab70a2ad2926",
:ref=>"refs/heads/master",
:commits=>[
{
:commiter=>{:name=>"Luiz Felipe", :email=>"luiz.felipe.gp@gmail.com"},
:message=>"commit NOW 4",
:timestamp=>"2011-06-28 10:22:08",
@Draiken
Draiken / vagrantfile
Created June 30, 2011 17:53
my vagrantfile
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "vendor/cookbooks/vagrant_base"
chef.log_level = :debug
chef.add_recipe "apt"
chef.add_recipe "build-essential"
chef.add_recipe "networking_basic"
chef.add_recipe "openssl"
chef.add_recipe "git"
@Draiken
Draiken / recipe.rb
Created June 30, 2011 17:59
known hosts recipe
cookbook_file "/home/vagrant/.ssh/known_hosts" do
owner "vagrant"
group "vagrant"
mode 0755
source "known_hosts"
end
this is my tree inside custom_cookbooks
.
└── nzn
└── known_hosts
├── files
│   └── default
│   └── known_hosts
└── recipes
└── default.rb
@Draiken
Draiken / checkout_one_file.txt
Created June 30, 2011 20:09
Checkout only one file from a git repo
git clone --no-checkout --depth 1 git@github.com:foo/bar.git && cd bar && git show HEAD:path/to/file.txt
@Draiken
Draiken / retrieve_one_file_from_git.rb
Created July 1, 2011 15:43
Retrieving only one file from git
def fetch
rdm = Random.rand(2000)
file = `git clone --no-checkout --depth 1 --quiet #{repository.clone_url} /tmp/travis-yml-#{rdm} && cd /tmp/travis-yml-#{rdm} && git show HEAD:.travis.yml && rm -rf /tmp/travis-yml-#{rdm}`
file == "" ? {} : parse(file)
end
@Draiken
Draiken / bundler
Created July 7, 2011 11:29
bundler output
Using nzn_denounces (0.4.0) from ssh://git@201.22.7.190:2202/nzn_denounces.git (at master) fatal: Not a git repository (or any of the parent directories): .git
Git error: command `git fetch --force --quiet --tags "/home/vagrant/.rvm/gems/ruby-1.9.2-p180/cache/bundler/git/nzn_denounces-4e2858d3b9052ba97aff50920a9d94c6ef48a38a"` in directory /home/vagrant/.rvm/gems/ruby-1.9.2-p180/bundler/gems/nzn_denounces-7565d484f2df has failed.
If this error persists you could try removing the cache directory '/home/vagrant/.rvm/gems/ruby-1.9.2-p180/cache/bundler/git/nzn_denounces-4e2858d3b9052ba97aff50920a9d94c6ef48a38a'
@Draiken
Draiken / bundler.out
Created July 7, 2011 13:44
Bundler output
$ bundle install
ssh://git@201.22.7.190:2202/nzn_categories.git
remote: Counting objects: 510 [K
remote: Counting objects: 1609, done.[K
remote: Compressing objects: 100% (1278/1278), done.[K
Receiving objects: 64% (1030/1609)
Receiving objects: 98% (1577/1609)
remote: Total 1609 (delta 663), reused 624 (delta 160)[K
Receiving objects: 100% (1609/1609), 2.80 MiB, done.
Resolving deltas: 100% (663/663), done.
@Draiken
Draiken / Gemfile
Created July 7, 2011 13:52
Gemfile
source "http://gems.github.com"
source 'http://rubygems.org'
source 'http://gemcutter.org'
gem 'rails', '3.0.9'
gem 'rake', "0.8.7"
gem 'dynamic_form'
gem 'jquery-rails'
gem 'hoptoad_notifier'