Skip to content

Instantly share code, notes, and snippets.

Dmitriy Zaporozhets dzaporozhets

Block or report user

Report or block dzaporozhets

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dzaporozhets
dzaporozhets / notes.md
Created Dec 24, 2016 — forked from sixfeetover/notes.md
MacOS Sierra upgrade for Rubyists
View notes.md

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 Nov 9, 2015 — forked from romansklenar/REAME.md
How to set up your VPS with Chef Solo
View REAME.md

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.

View http-benchmark.md

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
View rspec_rails_cheetsheet.rb
#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)
View gist:989e342ffecc055c4aae

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:
View git-pre-receive-hook.sh
#!/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 Dec 20, 2013
GitLab CE build scenario
View build.sh
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
You can’t perform that action at this time.