Wednesday, 22 November 2017

Tensorflow for ruby

https://news.ycombinator.com/item?id=12603890


https://medium.com/@Arafat./introducing-tensorflow-ruby-api-e77a477ff16e

https://github.com/somaticio/tensorflow.rb

https://medium.com/@Arafat./image-recognition-in-ruby-tensorflow-df5d5c05389b

Friday, 17 November 2017

Thursday, 2 November 2017

kerl

#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
$ kerl build R16B03 build-R16B03
$ kerl list builds
$ kerl install build-R16B03 ~/erlang/R1603/
Installing Erlang/OTP R16B03 (build-R16B03) in /Users/ioannis/erlang/R1603...
You can activate this installation running the following command:
. /Users/ioannis/erlang/R1603/activate
Later on, you can leave the installation typing:
kerl_deactivate
$ kerl list installations
build-R16B03 /Users/ioannis/erlang/R1603
ioannis@MacBook-Pro ~ ⚡️ which erl
/Users/ioannis/erlang/R1603/bin/erl
ioannis@MacBook-Pro ~ ⚡️ erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
"R16B03"
view raw kerl.sh hosted with ❤ by GitHub
https://github.com/kerl/kerl

Tuesday, 24 October 2017

quick graphql implementation for grape gem Raw

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
MultiJson.dump(object)
end
end
end
end
end
# a = [:id, jobs: [:id, country: :id]].to_query('__only__')
# => "__only__%5B%5D=id&__only__%5B%5D%5Bjobs%5D%5B%5D=id&__only__%5B%5D%5Bjobs%5D%5B%5D%5Bcountry%5D=id"
# http://localhost:9292/bundles/68?__only__%5B%5D=id&__only__%5B%5D%5Bjobs%5D%5B%5D=id&__only__%5B%5D%5Bjobs%5D%5B%5D%5Bcountry%5D=id
view raw json.rb hosted with ❤ by GitHub

About gRPC

gRPC is a modern open source high performance RPC framework that can run in any environment. It can efficiently connect services in and across data centers with pluggable support for load balancing, tracing, health checking and authentication. It is also applicable in last mile of distributed computing to connect devices, mobile applications and browsers to backend services.



https://grpc.io/about/

Wednesday, 18 October 2017

PRINCIPLES OF CHAOS ENGINEERING

CHAOS IN PRACTICE

To specifically address the uncertainty of distributed systems at scale, Chaos Engineering can be thought of as the facilitation of experiments to uncover systemic weaknesses.  These experiments follow four steps:
  1. Start by defining ‘steady state’ as some measurable output of a system that indicates normal behavior.
  2. Hypothesize that this steady state will continue in both the control group and the experimental group.
  3. Introduce variables that reflect real world events like servers that crash, hard drives that malfunction, network connections that are severed, etc.
  4. Try to disprove the hypothesis by looking for a difference in steady state between the control group and the experimental group.
The harder it is to disrupt the steady state, the more confidence we have in the behavior of the system.  If a weakness is uncovered, we now have a target for improvement before that behavior manifests in the system at large.


http://principlesofchaos.org/

Tuesday, 3 October 2017

ruby

  • $! - latest error message
  • $@ - location of error
  • $_ - string last read by gets
  • $. - line number last read by interpreter
  • $& - string last matched by regexp
  • $~ - the last regexp match, as an array of subexpressions
  • $n - the nth subexpression in the last match (same as $~[n])
  • $= - case-insensitivity flag
  • $/ - input record separator
  • $\ - output record separator
  • $0 - the name of the ruby script file
  • $* (or ARGV) - the command line arguments
  • $$ - interpreter’s process ID
  • $? - exit status of last executed child process
  • $-i $-l $-p $-v - Command line switches
  • $-v (or $VERBOSE) - verbose mode

Wednesday, 7 June 2017

Installing graphite and statsd on OS X Yosemite Raw

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:

cd /usr/local/Library/
git checkout 7073788 /usr/local/Library/Formula/cairo.rb
brew install cairo
brew install py2cairo
sudo pip install cairocffi

Install Django

pip install Django==1.8
pip install django-tagging

Install Graphite

sudo pip install carbon
pip install whisper
sudo pip install graphite-web
sudo pip install Twisted==15.2

sudo chown -R <your username>:staff /opt/graphite

Configure graphite

cd /opt/graphite
cp conf/carbon.conf{.example,}
cp conf/storage-schemas.conf{.example,}

cd webapp/graphite

# Modify this file to change database backend (default is sqlite).
cp local_settings.py{.example,}

# Initialize database
python manage.py syncdb

Start carbon & graphite

python /opt/graphite/bin/carbon-cache.py start

(Ignore this error: WHISPER_FALLOCATE_CREATE is enabled but linking failed.)

python /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite

Hope that it works!

Go to:

http://localhost:8080

You should see this if it works properly:

bacon

If you get a broken image, it most likely means that something is wrong py2cairo and cairo.

Check the debug output here:

http://localhost:8080/render

Optional convenience aliases

Add this to your .bashrc or .bash_profile or .aliasrc:

alias carbon='python /opt/graphite/bin/carbon-cache.py'
alias graphite-web='python /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite'

Statsd

Install Node

brew install nodejs

Clone the repo

sudo git clone https://github.com/etsy/statsd.git /opt/statsd
sudo chown -R trusche:staff /opt/statsd

Configure statsd

cp /opt/statsd/exampleConfig.js /opt/statsd/config.js

Fire it up!

node /opt/statsd/stats.js /opt/statsd/config.js

node statsd /

Resources

view raw statsd.md hosted with ❤ by GitHub

Kill all IRB and PRY process Raw

ps -ef | grep 'irb' | awk '{print $2}' | xargs kill -9
ps -ef | grep 'pry' | awk '{print $2}' | xargs kill -9
view raw gistfile1.sh hosted with ❤ by GitHub

Monday, 29 May 2017

GolangTraining

GolangTraining

Training for Golang (go language)
https://github.com/GoesToEleven/GolangTraining

Wednesday, 24 May 2017

There's a Monster in My Closet: Architecture of a MongoDB-Powered Event Processing System

https://www.mongodb.com/presentations/theres-monster-my-closet-architecture-mongodb-powered-event-processing-system

Tuesday, 11 April 2017

AWS Well-Architected Framework

https://d0.awsstatic.com/whitepapers/architecture/AWS_Well-Architected_Framework.pdf


Abstract 

This paper describes the AWS Well-Architected Framework, which enables customers to review and improve their cloud-based architectures and better understand the business impact of their design decisions. We address general design principles as well as specific best practices and guidance in five conceptual areas that we define as the pillars of the Well-Architected Framework.

Thursday, 9 February 2017

Victor Nava: List of books I read last year


Victor Nava: 38 Antifragile by Nassim Nicholas Taleb (Philosophy, Economics) ⭐️
37 Emotional Intelligence by Daniel Goleman (Psychology)
36 The ascent of Man by Jacob Bronowski (Science, History)
34 Enchiridion by Epictetus (Philosophy)
34 V for Vendetta by Alan Moore & David Lloyd (Fiction)
33 The Republic by Plato (Philosophy) ⭐️
32 Meditations by Marcus Aurelius (Philosophy)
31 Letters from a Stoic by Seneca (Philosophy)
30 Making Comics by Scott McCloud (Design)
29 Universal principles of design (Design)
28 A Guide to the Good Life by William Irvine (Philosophy) ⭐️⭐️
27 Don't make me think by Steve Krug (Design)
26 Reinventing Comics by Scott McCloud (Design)
25 The Bulletproof Diet by Dave Asprey (Nutrition)
24 Making reliable distributed systems in the presence of sodware errors by Joe Armstrong (Software)
23 The Goal: A Process of Ongoing Improvement by Eliyahu M. Goldratt (Business) ⭐️
22 Mindset: The new Psycology of success by Carol Dweck (Psycology)
21 The master and Margarita by Mikhail Bulgakov (Fiction)
20 Learned Optimism by Martin Seligman (Psychology)
19 Average to A+ by Alex Linley (Personal Development)
18 The curious incident of the dog in the nighttime by Mark Haddon (Fiction)
17 Secrets of the JavaScript Ninja by John Resig (Software)
16 Turtle Geometry by Abelson and diSessa (Software)
15 Thinking in Systems by Donella H. Meadows (Systems) ⭐️
14 Logic and Design by Krome Barratt (Design)
13 The brain's way of healing by Norman Doidge (Psychology, Health)  
12 The Personal MBA: Master the Art of Business (Business)
11 Cradle to Cradle by Michael Braungart and William McDonough (Design) ⭐️
10 Elon Musk by Ashlee Vance (Business) ⭐️
9  To Sell is Human by Daniel Pink (Business)
8  The Lean Startup (Business)
7  The Humane Interface Jef Raskin (Design)
6  The Elements of Graphing Data by William S. Cleveland (Design,Visualisation)
5  The War of Art by Steven Pressfield (Personal Development) ⭐️
4  So Good They Can't Ignore You by Newport (Personal Development)
3  Programming Elixir by Dave Thomas (Software)
2  Megg's History of Graphic Design by Philip B. Meggs (Design)
1  $100 Startup by Chris Guillebeau (Business)


Victor Nava: The ones with stars are really good

Tuesday, 7 February 2017

Thursday, 2 February 2017

initializer.rb

ActiveSupport::Notifications.subscribe do |*args|
event = ActiveSupport::Notifications::Event.new(*args)
Rails.logger.info "#" * 30
Rails.logger.info "#{event.name} => #{event.duration}"
end
view raw initializer.rb hosted with ❤ by GitHub

ActionController.rb

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
prepend_before_filter :rails_yo_before_filter
after_filter :rails_yo_after_filter
end
end
def rails_yo_before_filter
Rails.logger.info "rails_yo_before_filter"
end
def rails_yo_after_filter
Rails.logger.info "rails_yo_after_filter"
end
end
end
ActionController::Base.send(:include, Yo::Man)

Tuesday, 31 January 2017

ELK Stack

logstash json format

{
  "message"    => "hello world",
  "@version"   => "1",
  "@timestamp" => "2014-04-22T23:03:14.111Z",
  "type"       => "stdin",
  "host"       => "hello.local"
}
  • @timestamp is the ISO8601 high-precision timestamp for the event.
  • @version is the version number of this json schema
  • Every other field is valid and fine.

Observe it in real life

You can observe the message structure by doing output { stdout { codec => rubydebug } }

% bin/logstash  -e 'output { stdout { codec => rubydebug } }'
hello world

{
  "message"    => "hello world",
  "@version"   => "1",
  "@timestamp" => "2014-04-22T23:03:14.111Z",
  "type"       => "stdin",
  "host"       => "Macintosh.local"
}
view raw foo.md hosted with ❤ by GitHub





http://brewhouse.io/blog/2014/11/04/big-data-with-elk-stack.html

Thursday, 26 January 2017