Skip to content

Instantly share code, notes, and snippets.

@webchi
webchi / consul.xml
Created October 30, 2018 09:13 — forked from fabricekabongo/consul.xml
Service definition of Consul for Firewalld
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>consul</short>
<description>Consul makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface. Register external services such as SaaS providers as well.</description>
<port protocol="tcp" port="8300"/>
<port protocol="tcp" port="8301"/>
<port protocol="tcp" port="8302"/>
<port protocol="tcp" port="8400"/>
<port protocol="tcp" port="8500"/>
<port protocol="tcp" port="8600"/>
@webchi
webchi / packer.log
Created October 14, 2018 07:56
packer.log
PACKER_LOG=1 packer build ./docker-cri.json
2018/10/14 10:46:54 [INFO] Packer version: 1.3.1
2018/10/14 10:46:54 Packer Target OS/Arch: linux amd64
2018/10/14 10:46:54 Built with Go Version: go1.11
2018/10/14 10:46:54 Detected home directory from env var: /home/icha1
2018/10/14 10:46:54 Using internal plugin for openstack
2018/10/14 10:46:54 Using internal plugin for vmware-iso
2018/10/14 10:46:54 Using internal plugin for alicloud-ecs
2018/10/14 10:46:54 Using internal plugin for amazon-ebs
2018/10/14 10:46:54 Using internal plugin for hyperv-vmcx
@webchi
webchi / miner.graphql
Created September 24, 2018 07:59
Graphql resolvers
type Miner {
name: String!
foundBlocks(limit: Int): [FoundBlock]
}
### Keybase proof
I hereby claim:
* I am webchi on github.
* I am icha1 (https://keybase.io/icha1) on keybase.
* I have a public key ASDvrm2n5xgzrdM_5QG5jNrsQDO8IdhzohFl1411Ef7rjwo
To claim this, I am signing this object:
@webchi
webchi / gist:0daa94cdb7b098171170c4dd9058fc52
Created April 5, 2018 07:05 — forked from mislav/gist:938183
Faraday SSL example
connection = Faraday::Connection.new('http://example.com') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
end
# same as above, short form:
connection = Faraday.new 'http://example.com'
# GET
connection.get '/posts'
@webchi
webchi / gist:473a937e607eb718450e96bec1424b9a
Created August 28, 2017 11:47
Yandex MAP object from json
ymaps.ready()
.done(function (ym) {
myMap = new ymaps.Map("map", {
center: [59.704197, 30.023431],
zoom: 13
});
jQuery.getJSON('home/cameras.json', function (json) {
var geoObjects = ym.geoQuery(json)
@webchi
webchi / devise_helper.rb
Last active February 26, 2016 20:17 — forked from seyhunak/devise_helper.rb
Devise Error Messages Twitter Bootstrap style
# /app/helpers/devise_helper.rb
module DeviseHelper
def devise_error_messages!
return '' if resource.errors.empty?
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
sentence = I18n.t('errors.messages.not_saved',
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)
@webchi
webchi / environment.rb
Created March 19, 2012 00:56
Custom form error messages for rails and yaml.de css framework
# This this replacemnt for default rails field_with_errors for using http://www.yaml.de/docs/index.html#yaml-forms
# Add this to ./config/environment.rb file
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
if html_tag =~ /<label/
%|<div class="ym-error"><p class="ym-message">#{[instance.error_message].join(', ')}</p>#{html_tag}</div>|.html_safe
else
%|<div class="ym-error">#{html_tag}</div>|.html_safe
end
@webchi
webchi / deploy.rb
Created March 9, 2012 21:18
Ultimate capistrano config file with rvm, bundle, git, passanger restart, symlink to databae.yml and db:migrate
# RVM
# Add RVM's lib directory to the load path.
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
# Load RVM's capistrano plugin.
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.3@rails321'
set :rvm_type, :user # Copy the exact line. I really mean :user here
set :normalize_asset_timestamps, false # Убирает сёр ошибок со старыми папками жаваскрипта и имаджов
#Bundle