George Opritescu

Developer from somewhere

maven surefire run with test timeout option

Assuming you have the maven-surefire-plugin, this option is useful:

mvn -Dsurefire.timeout=60 test
Read More

timeout command from the shell

[vagrant@localhost ~]$ timeout 2 bash -c "sleep 3"
[vagrant@localhost ~]$ echo $?
124
Read More

printing to output with groovy in a jenkins postbuild step

Found answer here:

manager.listener.logger.println("Some string")
Read More

activerecord check date between

Was writing a raw query, when I remembered about range support:

User.where(created_at: Time.zone.now-2.hours..Time.zone.now)
Read More

^M instead of enter

Sometimes my terminal outputs ^M when pressing enter. Running the command stty sane fixes it. Found the answer here

Read More
osx

terminal inside neovim

The command :terminal will start a new command. For example:

:term rails c

would start rails c in a new buffer. To get out of terminal mode, and be able to switch through splits, use the following combination: ctrl-\ ctrl-n. That is ctrl-backspace, followed by a ctrl-n.

Read More

cloning with different ssh key from github

I needed to do a git clone using a different key than my own. This was what I had to do to get it to work:

  • in ~/.ssh/config , I setup the following:
Host github-work
  HostName github.com
  IdentityFile /path/to/the/private_key
  User the_github_username
  • add the key to the ssh-agent:
ssh-add /path/to/private/key
  • export GIT_SSH_COMMAND:
export GIT_SSH_COMMAND="ssh -i /path/to/the/private_key"
  • the actual clone:
git clone git@github-work:organization_name/repo.git

This StackOverflow answer helped me with this.

Read More

Vagrant experienced a version conflict with some installed plugins!

Tried to run vagrant ssh-config from within capistrano, and got the following message:

Vagrant experienced a version conflict with some installed plugins!
This usually happens if you recently upgraded Vagrant. As part of the
upgrade process, some existing plugins are no longer compatible with
this version of Vagrant. The recommended way to fix this is to remove
your existing plugins and reinstall them one-by-one. To remove all
plugins: ...

Turns out, the fix was to run ssh-config like this:

system("unset RUBYLIB; vagrant ssh-config")

Found the solution here

Read More

capistrano invoke task with params

Imagine the following code:

desc "callerz"
task :callerz do
  set :branch, "potato"
  called_with
end

desc "called with param"
task :called_with do
  br = variables[:branch]
  puts "called with branch #{br}"
end

In the above example, the task called_with can be passed a param form the command line:

cap called_with -s branch=master

And this allows us to send a parameter, from the commandline. The output will be:

called with branch master

If you need to call a parameterized task from another task, the above task, callerz illustrates one way of getting that result. You invoke it like this:

cap callerz

And inside, it sets the variable branch to a value. The output will be:

called with branch potato

The above code was tested in capistrano 2.15.8

Read More

iex config file

If you defined a

1
.iex.exs
file, it’s content will be evaluated when iex starts. Easy to setup aliases to stuff

Read More