Skip to content

Instantly share code, notes, and snippets.

View gigorok's full-sized avatar

Igor Gonchar gigorok

  • DIDWW
  • Ukraine, Odesa
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 / 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 / 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
# 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 <[email protected]>
# Created: 2010-08-16
set -um
# check input
[ $# -gt 0 ] || { sed -n '2,/^#$/ s/^# //p' <"$0"; exit 1; }
# In config/initializers/local_override.rb:
require 'devise/strategies/authenticatable'
module Devise
module Strategies
class LocalOverride < Authenticatable
def valid?
true
end
<?php
class Vkapi {
protected $_access_token = '';
public static function factory ()
{
$class = get_class();
return new $class;
}