Skip to content

Instantly share code, notes, and snippets.

View gigorok's full-sized avatar

Igor Gonchar gigorok

  • DIDWW
  • Ukraine, Odessa
View GitHub Profile
@gigorok
gigorok / 1-setup.md
Created December 15, 2020 13:05 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing with either GPG or Krypt.co.

@gigorok
gigorok / gist:891f80cbc6c18857be1708c23dc9356b
Created July 25, 2018 08:29
installing rmagick 2.13.4 on mac os
with latest imagemagick 7 installation fails, so use
brew install imagemagick@5
PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick -v '2.13.4'
@gigorok
gigorok / rails.logrotate
Created March 19, 2018 18:01 — forked from constantinoneto/rails.logrotate
Logrotate for Rails
#
# File: /etc/logrotate.d/rails
# Test: logrotate -f /etc/logrotate.d/rails
#
/var/www/*/log/*.log {
daily
dateext
notifempty
missingok
rotate 30
@gigorok
gigorok / site.conf
Created August 25, 2017 17:46 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@gigorok
gigorok / gist:15195c6426f12378e983963256e51f8f
Created August 7, 2017 11:06
vim segmentation fault while autocomplete (using rvm)
rvm reinstall [version] -- --enable-shared
brew uninstall macvim
brew install macvim --with-override-system-vim
@gigorok
gigorok / rubocop_pre_commit_hook
Created April 5, 2017 09:42 — forked from timheilman/rubocop_pre_commit_hook
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified. Itself passes rubocop with default settings.
#!/usr/bin/env ruby
require 'rubocop'
require 'english'
ADDED_OR_MODIFIED = /A|AM|^M/
# to prevent code injection: system is a dangerous call
def raise_single_quote_error
raise ArgumentError, 'Single quotes are not allowed in filenames here.'
## http://stackoverflow.com/questions/7145256
module FactoryGirl
module Strategy
class Find
def association(runner)
runner.run
end
def result(evaluation)
build_class(evaluation).where(get_overrides(evaluation)).first
@gigorok
gigorok / gist:f61edd1f4c4f95082d6d
Created July 1, 2015 08:54
find unused factories
module FactoryGirl
mattr_accessor :used_factories
self.used_factories = []
def self.factory_by_name(name)
self.used_factories << name
factories.find(name)
end
# For inclusion into a Rails config/environments/development.rb file.
if defined?(BetterErrors) && RUBY_PLATFORM.index('darwin')
url_schemes = `/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep bindings:.*:`
BetterErrors.editor = :macvim if url_schemes.index('mvim:')
BetterErrors.editor = :emacs if url_schemes.index('emacs:')
BetterErrors.editor = :textmate if url_schemes.index('txmt:')
BetterErrors.editor = :sublime if url_schemes.index('sublime:')
# RubyMine:
BetterErrors.editor = "x-mine://open?file=%{file}&line=%{line}" if url_schemes.index('x-mine:')
@gigorok
gigorok / memusg
Last active August 29, 2015 14:08 — forked from netj/memusg
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
set -um
# check input
[ $# -gt 0 ] || { sed -n '2,/^#$/ s/^# //p' <"$0"; exit 1; }