Skip to content

Instantly share code, notes, and snippets.

View kont-noor's full-sized avatar

Nickolay Kondratenko kont-noor

View GitHub Profile
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@kont-noor
kont-noor / pre-commit
Last active August 29, 2015 14:17
git pre-commit hook
#!/bin/sh
#.git/hooks/pre-commit
patterns=("TODO" "binding.pry" "selenium")
status=0
for pattern in ${patterns[*]}
do
matches=`git-diff-index -p -M --cached HEAD -- | grep '^+' | grep -i "$pattern"`
matches_count=`git-diff-index -p -M --cached HEAD -- | grep '^+' | grep -i "$pattern" | wc -l`
@kont-noor
kont-noor / libusb-devel.rb
Created September 22, 2015 14:13 — forked from chambbj/libusb-devel.rb
My libusb-devel formula for Homebrew (for PCL installation on OS X Lion)
require 'formula'
class LibusbDevel < Formula
url 'https://github.com/OpenNI/OpenNI/blob/4dbf64bc45b880bfda6aa6bb2a30d1ddd03a8c65/Platform/Linux/Build/Prerequisites/libusb-1.0.8-osx.tar.bz2?raw=true'
homepage 'http://www.libusb.org/'
md5 '8ad20ec24b7612caf75a059a03f21dd8'
depends_on "automake" => :build
depends_on "libtool" => :build
@kont-noor
kont-noor / gist:c0ccd52c7f00a3490518
Created October 12, 2015 12:03 — forked from jordelver/gist:3139365
How to write an image file to an SD card under Mac OS X (for Raspberry Pi)

Find the SD card device

In this case, the SD card is /dev/disk4. DO NOT get this wrong or you may destroy all the data on the wrong disk/card/drive.

diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *160.0 GB   disk0

1: EFI 209.7 MB disk0s1

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@kont-noor
kont-noor / tmux-cheatsheet.markdown
Created February 8, 2016 09:13 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@kont-noor
kont-noor / solution.md
Created September 28, 2017 13:07 — forked from kendagriff/solution.md
Solution to "OpenSSL::X509::StoreError: setting default path failed: Invalid keystore format" for JRuby

Solution to StoreError: invalid keystore format (OS X)

The following error appeared upon upgrading JRuby:

OpenSSL::X509::StoreError: setting default path failed: Invalid keystore format

Download cacert.pem

#!/bin/bash
#
# Bash script to setup headless Selenium (uses Xvfb and Chrome)
# (Tested on Ubuntu 12.04) trying on ubuntu server 14.04
# Add Google Chrome's repo to sources.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee -a /etc/apt/sources.list
# Install Google's public key used for signing packages (e.g. Chrome)
# (Source: http://www.google.com/linuxrepositories/)
@kont-noor
kont-noor / uninstall_gems.sh
Created October 30, 2018 11:32 — forked from IanVaughan/uninstall_gems.sh
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
@kont-noor
kont-noor / import.md
Created June 24, 2019 07:00 — forked from iamstoick/import.md
How to import database in MySQL in Docker?

This is a simple way of importing MySQL database in Docker.

  1. In you Dockerfile you must have a shared folder. Shared folder is a directory in your host machine that is mounted to Docker instance.

  2. Put the exported sql file in the shared folder.

  3. Login to your Docker instance via docker exec -it DOCKER_CONTAINER_ID bin/bash.

  4. Login to MySQL via mysql -u USERNAME -p.