Skip to content

Instantly share code, notes, and snippets.

View zotherstupidguy's full-sized avatar

Mo zotherstupidguy

  • hackspree
  • simplicity is the final achievement
View GitHub Profile
@zotherstupidguy
zotherstupidguy / ml-ruby.md
Created December 2, 2016 07:31 — forked from gbuesing/ml-ruby.md
Resources for Machine Learning in Ruby

Resources for Machine Learning in Ruby

Gems

@zotherstupidguy
zotherstupidguy / gist:89ea48378ec8831d3f7d498b6a621d3b
Created November 27, 2016 21:53 — forked from SzymonPobiega/gist:5220595
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@zotherstupidguy
zotherstupidguy / matz.rb
Last active November 16, 2016 17:45
nested methods
def a &block
p "a"
def b &block
p "b"
def c &block
p "c"
instance_eval &block
end
instance_eval &block
undef :c
  • Dynamic Dispatch
  • Dynamic Method
  • Ghost Methods
  • Dynamic Proxies
  • Blank Slate
  • Kernel Method
  • Flattening the Scope (aka Nested Lexical Scopes)
  • Context Probe
  • Class Eval (not really a 'spell' more just a demonstration of its usage)
  • Class Macros
@zotherstupidguy
zotherstupidguy / hack.rb
Last active November 15, 2016 07:11
love ruby dynamic methods
define_method("love") do |person: "mo", &block|
@person = person
p "this is an activity from inside define method"
instance_eval &block
end
love person: "makki" do
p "love you #{@person}"
end
@zotherstupidguy
zotherstupidguy / ssl_puma.sh
Created October 26, 2016 06:02 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@zotherstupidguy
zotherstupidguy / gen_keys.sh
Created October 25, 2016 16:58 — forked from hvasconcelos/gen_keys.sh
Create an Sinatra SSL Server
# Generate a self-signed Certificate and a Private Key
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout pkey.pem -out cert.crt
@zotherstupidguy
zotherstupidguy / yes_web_api.rb
Created August 18, 2016 05:07 — forked from kimoto/yes_web_api.rb
yes WEB API (Ruby + Sinatra/Streaming)
# coding: utf-8
require 'sinatra'
require 'sinatra/streaming'
set server: 'thin', connections: []
th = Thread.new{
while true
puts "currently connection: #{settings.connections.size}"
settings.connections.each{ |e|
e << "yes\n"
module SSD
def self.included base
base.send :include, InstanceMethods
base.extend ClassMethods
end
module InstanceMethods
def print
p "hello world from SSD"
end
@zotherstupidguy
zotherstupidguy / docker-compose-install.sh
Last active August 10, 2016 10:02 — forked from marszall87/docker-compose-install.sh
Simple script for installing latest Docker Compose on CoreOS >= 717.0.0
#!/bin/bash
# Usage: curl gist-raw-path | sudo sh
mkdir -p /opt/bin
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose