Skip to content

Instantly share code, notes, and snippets.

View msroot's full-sized avatar
:octocat:

Yannis Kolovos msroot

:octocat:
View GitHub Profile
@msroot
msroot / kerl.sh
Last active November 2, 2017 21:25
#View erl's version
erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
#Install kerl
$ brew install kerl
# list releases
$ kerl list releases
@msroot
msroot / json.rb
Created October 25, 2017 00:13
quick graphql implementation for grape gem
module Grape
module Formatter
module Json
class << self
def call(object, _env)
only = _env[Grape::Env::RACK_REQUEST_QUERY_HASH]["__only__"]
if object.respond_to?(:to_json)
return only.present? ? object.to_json(only: only) : object.to_json
end
@msroot
msroot / kue_cleanup.js
Created October 19, 2017 23:03 — forked from niravmehta/kue_cleanup.js
Cleanup script for Kue job queueing system in Node.js. Deletes failed, active and completed jobs after specified time. Can run on command line directly with "node kue_cleanup". Requires Kue installed :-)
var kue = require('kue'),
jobs = kue.createQueue(),
util = require('util'),
noop = function() {};
jobs.CLEANUP_MAX_FAILED_TIME = 30 * 24 * 60 * 60 * 1000; // 30 days
jobs.CLEANUP_MAX_ACTIVE_TIME = 1 * 24 * 60 * 60 * 1000; // 1 day
jobs.CLEANUP_MAX_COMPLETE_TIME = 5 * 24 * 60 * 60 * 1000; // 5 days
jobs.CLEANUP_INTERVAL = 5 * 60 * 1000; // 5 minutes
@msroot
msroot / ansible-summary.md
Created October 5, 2017 22:21 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@msroot
msroot / statsd.md
Created June 8, 2017 00:50 — forked from trusche/statsd.md
Installing graphite and statsd on OS X Yosemite

Prerequisites

  • Homebrew
  • Python 2.7
  • Git

Graphite

Install Cairo

There's an issue with cairo 14.x that results in the axis fonts on the graphs being HUUUUUGE. Downgrading to 12.6 helps:

@msroot
msroot / gist:af4b2c748e6787bb71772df157b922b8
Created June 7, 2017 22:41
Kill all IRB and PRY process
ps -ef | grep 'irb' | awk '{print $2}' | xargs kill -9
ps -ef | grep 'pry' | awk '{print $2}' | xargs kill -9
require "rubygems"
require "yaml"
require "open-uri"
collection_path = 'https://raw.githubusercontent.com/msroot/get_happy_sync/master/collection.yml'
`open #{YAML.load(open(collection_path)).sample}`
ActiveSupport::Notifications.subscribe do |*args|
event = ActiveSupport::Notifications::Event.new(*args)
Rails.logger.info "#" * 30
Rails.logger.info "#{event.name} => #{event.duration}"
end
module Yo
module Man
extend ActiveSupport::Concern
included do
if Rails::VERSION::MAJOR >= 5
prepend_before_action :rails_yo_before_filter
after_action :rails_yo_after_filter
else
ssh user@host 'bash -s' < a.sh