Skip to content

Instantly share code, notes, and snippets.

@konalegi
konalegi / gist:e482e3d1def9ddabf255
Created January 27, 2015 18:52
for ramil exmaple
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 923 root 3u IPv4 9237 0t0 TCP *:22 (LISTEN)
sshd 923 root 4u IPv6 9240 0t0 TCP *:22 (LISTEN)
named 954 bind 20u IPv6 9290 0t0 TCP *:53 (LISTEN)
named 954 bind 21u IPv4 9297 0t0 TCP 127.0.0.1:53 (LISTEN)
named 954 bind 22u IPv4 9299 0t0 TCP 95.85.29.26:53 (LISTEN)
named 954 bind 23u IPv4 9363 0t0 TCP 127.0.0.1:953 (LISTEN)
named 954 bind 24u IPv6 9364 0t0 TCP [::1]:953 (LISTEN)
named 954 bind 512u IPv6 9289 0t0 UDP *:53
named 954 bind 513u IPv4 9296 0t0 UDP 127.0.0.1:53
@konalegi
konalegi / error.log
Last active August 29, 2015 14:06
riak_cs logs
2014-09-23 10:45:18.710 [error] <0.149.0> Supervisor riak_cs_sup had child riak_cs_gc_d started with riak_cs_gc_d:start_link() at <0.24099.126> exit with reason no match of right hand value {error,all_workers_busy} in riak_cs_gc_key_list:gc_index_query/5 line 153 in context child_terminated
2014-09-23 11:00:18.710 [error] <0.27448.126> gen_fsm riak_cs_gc_d in state fetching_next_batch terminated with reason: no match of right hand value {error,all_workers_busy} in riak_cs_gc_key_list:gc_index_query/5 line 153
2014-09-23 11:00:18.710 [error] <0.27448.126> CRASH REPORT Process riak_cs_gc_d with 1 neighbours exited with reason: no match of right hand value {error,all_workers_busy} in riak_cs_gc_key_list:gc_index_query/5 line 153 in gen_fsm:terminate/7 line 611
2014-09-23 11:00:18.711 [error] <0.149.0> Supervisor riak_cs_sup had child riak_cs_gc_d started with riak_cs_gc_d:start_link() at <0.27448.126> exit with reason no match of right hand value {error,all_workers_busy} in riak_cs_gc_key_list:gc_index_query/5 l
ChatApp = angular.module('ChatApp', []);
ChatApp.config(function ($httpProvider) {
$httpProvider.defaults.headers.common['X-CSRF-TOKEN'] = $("meta[name=\"csrf-token\"]").attr("content");
});
ChatApp.controller('ChatController', function ($scope, $http) {
$scope.messages = [];
$scope.send = function () {
var message = $scope.new_message;
@konalegi
konalegi / .gitconfig
Created July 20, 2014 06:39
git settings
[color]
diff = auto
status = auto
branch = auto
interactive = auto
[diff]
renamelimit = 0
[merge]
summary = true
[alias]
def self.get_geo_object(fias_object)
address_encoded = URI.encode fias_object.address.strip
url = "http://geocode-maps.yandex.ru/1.x/?geocode=#{address_encoded}"
xml = Hash.from_xml(RestClient.get(url))
count = xml["ymaps"]["GeoObjectCollection"]["metaDataProperty"]["GeocoderResponseMetaData"]["found"].to_i
p url
p count
if (count > 1)
pos = xml["ymaps"]["GeoObjectCollection"]["featureMember"][0]["GeoObject"]["Point"]["pos"]
else
@konalegi
konalegi / application_controller.rb
Created May 26, 2014 08:16
rails api validation
rescue_from TypeExceptions::InvalidParamsError, with: :handle_invalid_params
def handle_invalid_params e
render json: e.message, status: :unprocessable_entity
end
@konalegi
konalegi / SignUpType.rb
Created May 23, 2014 09:12
angular simple form
class SignUpType < BaseType
attribute :email, String
attribute :password, String
attribute :password_confirmation, String
attribute :name, String
attribute :surname, String
validates :email, email: true, :presence => { :message => "sign_up_type.email.presense" }
validates :password, :presence => { :message => "sign_up_type.password.presense" }
require 'test_helper'
require 'controllers/api/speakphone/test_helper'
class Api::Speakphone::CompaniesControllerTest < ActionController::TestCase
@acl_hash = {
admin: { index: :success , update: :success , create: :success , destroy: :success },
content_manager:{ index: :success , update: :success , create: :success , destroy: :success },
device_manager:{ index: :success , update: :unauthorized , create: :unauthorized , destroy: :unauthorized }
scope.acl = {}
return unless @user?
scope.is_authenticated = @isLogged()
scope.user = @user
for key,role of @user.roles
for resource_key, resource of window.Acl[@user.company_namespace].acl
for action_key, action of resource
if action[role]?
@konalegi
konalegi / child
Last active August 29, 2015 13:57
class @UserTypeAhead extends AngularDirective
link: (scope, element, attrs, controller) =>
@$log.debug('hello from child');
console.log('element: ',element);
App.directive 'userTypeahead', new UserTypeAhead('$log')