Skip to content

Instantly share code, notes, and snippets.

View dzaporozhets's full-sized avatar

Dmitriy Zaporozhets dzaporozhets

View GitHub Profile
@dzaporozhets
dzaporozhets / notes.md
Created December 24, 2016 10:54 — forked from sixfeetover/notes.md
MacOS Sierra upgrade for Rubyists

Upgrading to Sierra for Ruby Devs

Often when upgrading to the latest OS X MacOS you have to do a few things to account for changing to underlying libraries. Here are the post-upgrade steps I took to get back to a fully operational state. I use homebrew and rbenv to manage my environment.

1. Get your Developer Command line tools upgraded.

To do this just run

$ xcode-select --install
@dzaporozhets
dzaporozhets / REAME.md
Created November 9, 2015 19:10 — forked from romansklenar/REAME.md
How to set up your VPS with Chef Solo

How to set up your VPS with Chef Solo

1. What is it?

There are many different provisioning tools out there, the most popular of which are Chef and Puppet. Chef uses Ruby, Puppet uses a DSL (Domain Specific Language), there are others that use simple bash too, but today we're going to focus on Chef Solo.

2. Dependencies

To get Chef working properly on your local machine you need a few things.

Make sure you use Ruby 1.9.x and not Ruby 2.x as you will get errors with the json 1.6.1 gem on 2.x. Use rbenv or RVM to manage several different Rubies on the one machine.

Tools

  • ab - slow and single threaded
  • apib - most of the features of Apache Bench (ab), but is also intended as a more modern replacement #design
  • BaukBench - ????
  • boom - HTTP(S) load generator, ApacheBench (ab) replacement, written in Go
  • htstress multithreading support which is essential in bechmarking highload services (>5K rps)
  • httperf - difficult configuration, slow and single threaded
  • inundator - A simple and high-throughput HTTP flood program (linux only)
  • pounce - evented, but results fluctuate, it's sometimes faster than htstress
def wow
puts "Yay"
end
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)

Steps to migrate from SVN to GitLab

This process worked for me. I take no responsibility for any damage or loss incurred as a result of following or not following these steps or, for that matter, anything else you might do or not do.

Setup

  • SVN is hosted at svn.domain.com.au.
  • SVN is accessible via http (other protocols should work).
  • GitLab is hosted at git.domain.com.au and:
class Test; end
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.
@dzaporozhets
dzaporozhets / build.sh
Created December 20, 2013 12:03
GitLab CE build scenario
ruby -v
gem install bundler
cp config/database.yml.mysql config/database.yml
cp config/gitlab.yml.example config/gitlab.yml
sed "s/username\:.*$/username\: USERNAME/" -i config/database.yml
sed "s/password\:.*$/password\: 'PASSWORD'/" -i config/database.yml
touch log/application.log
touch log/test.log
bundle --without postgres
bundle exec rake gitlab:test RAILS_ENV=test