Skip to content

Instantly share code, notes, and snippets.

View felippemr's full-sized avatar
💭
Enjoying the ride

Felippe da Motta Raposo felippemr

💭
Enjoying the ride
  • Carta
  • Cupertino, CA
View GitHub Profile
@felippemr
felippemr / tmux_vs_screen.md
Created December 31, 2020 00:37 — forked from P7h/tmux_vs_screen.md
tmux vs screen commands

tmux vs. screen commands


Action tmux screen
start a new session tmux
tmux new
tmux new-session
screen
start a new session with a name tmux new -s name screen -S name
re-attach a detached session tmux attach
tmux attach-session
screen -r
re-attach a detached session with a name tmux attach -t name
tmux a -t name
screen -r name
re-attach an attached session (detaching it from elsewhere) tmux attach -dtmux attach-session -d screen -dr
@felippemr
felippemr / simple_health_check.py
Created August 11, 2016 18:39
A simple health check class which stores result on redis
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
from contextlib import contextmanager
LOG = logging.getLogger(__name__)
class HealthCheckError(Exception):
@felippemr
felippemr / LICENSE
Created April 19, 2016 23:15 — forked from mepcotterell/LICENSE
Simple Python Plugin Manager
The MIT License (MIT)
Copyright (c) 2013 Michael E. Cotterell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@felippemr
felippemr / in_serverstatus.rb
Last active April 19, 2016 20:56 — forked from chrisckchang/in_serverstatus.rb
MongoDB serverStatus output plugin which works with mongoDB 3.0
module Fluent
class ServerStatusInput < Input
Plugin.register_input('serverstatus', self)
config_param :uris, :array, :default => nil
config_param :uri, :string
config_param :stats_interval, :time, :default => 60 # every minute
config_param :tag_prefix, :string, :default => "serverstatus"
def initialize
2016-02-16 12:46:25 -0200 [info]: adding source type="dstat"
2016-02-16 12:46:25 -0200 [info]: adding source type="serverstatus"
2016-02-16 12:46:26 -0200 [info]: adding source type="df"
2016-02-16 12:46:26 -0200 [info]: adding match pattern="dstat.reformer" type="copy"
2016-02-16 12:46:26 -0200 [info]: adding match pattern="dstat.**" type="copy"
2016-02-16 12:46:26 -0200 [info]: adding match pattern="serverstatus.reformer" type="copy"
2016-02-16 12:46:26 -0200 [info]: adding match pattern="serverstatus.**" type="copy"
2016-02-16 12:46:26 -0200 [info]: adding match pattern="df.reformer" type="copy"
2016-02-16 12:46:26 -0200 [info]: adding match pattern="df.**" type="copy"
2016-02-16 12:46:26 -0200 [error]: unexpected error error="undefined local variable or method `router' for #<Fluent::DstatInput:0x002aeae61c5f60>"
2016-02-16 11:13:25 -0200 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-statsd-1.0.3/lib/fluent/plugin/out_statsd.rb:31:in `to_msgpack'
2016-02-16 11:13:25 -0200 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-statsd-1.0.3/lib/fluent/plugin/out_statsd.rb:31:in `format'
2016-02-16 11:13:25 -0200 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.53/lib/fluent/output.rb:255:in `block in format_stream'
2016-02-16 11:13:25 -0200 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.53/lib/fluent/event.rb:55:in `call'
2016-02-16 11:13:25 -0200 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.53/lib/fluent/event.rb:55:in `each'
2016-02-16 11:13:25 -0200 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.53/lib/fluent/output.rb:254:in `format_stream'
2016-02-16 11:13:25 -0200 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.53/lib/fluent/output.rb:240:in `emit'
2016-02-16 11:13:25
<source>
type dstat
tag dstat
option -cnmlds
delay 1
</source>
<match dstat.reformer>
type copy
<store>
*** LOCAL GEMS ***
aws-sdk (1.52.0)
aws-sdk-v1 (1.52.0)
bson (4.0.1, 1.10.2)
bson_ext (1.10.2)
bundler (1.6.6)
cool.io (1.2.4)
diff-lcs (1.2.5)
fluent-logger (0.4.9)
@felippemr
felippemr / metodosQueEuUso
Created January 16, 2014 16:32
Aqui estão alguns métodos e classes que eu uso na autenticação da api.
def _provided_valid_password?
params[:user][:password] && UserAuthenticationService.authenticate_with_password!(@user, params[:user][:password])
end
class ApiController < ApplicationController
before_filter :api_session_token_authenticate!
private
@felippemr
felippemr / NoMethodError
Created January 16, 2014 16:29
NoMethodError at /api/sessions
NoMethodError at /api/sessions
==============================
> undefined method `api_session_token_url' for #<Api::SessionsController:0x007fe6bd6db568>
app/controllers/api/sessions_controller.rb, line 16
---------------------------------------------------
``` ruby
11 if params[:user][:username]