Skip to content

Instantly share code, notes, and snippets.

View jonathanccalixto's full-sized avatar

Jonathan C. Calixto jonathanccalixto

  • Yanotec Sistemas e serviços
  • Belo Horizonte, MG, BR
View GitHub Profile
@jonathanccalixto
jonathanccalixto / rm_mysql.md
Created July 16, 2018 09:02 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

# the instructions from here: https://stackoverflow.com/questions/3704919/installing-rmagick-on-ubuntu/31089915#31089915
# worked, but only after I added in line 8
sudo apt-get purge graphicsmagick graphicsmagick-dbg imagemagick-common imagemagick imagemagick-6.q16 libmagickcore-6-headers libmagickwand-dev graphicsmagick-libmagick-dev-compat
sudo apt-get autoremove
sudo apt-get install imagemagick libmagickwand-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
gem install rmagick
@jonathanccalixto
jonathanccalixto / Gemfile
Created April 22, 2018 05:30 — forked from goncalvesjoao/Gemfile
Changes you need to make in order to make Devise use JWT Header Authentication
# Add the "https://github.com/jwt/ruby-jwt" gem to your "Gemfile"
gem 'jwt'
@jonathanccalixto
jonathanccalixto / iOS-UploadImage.h
Created August 24, 2017 05:42 — forked from mombrea/iOS-UploadImage.h
example of a multi-part form post in objective-c
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"REST URL PATH"]];
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
[request setTimeoutInterval:60];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"unique-consistent-string";
@jonathanccalixto
jonathanccalixto / before.rules
Created November 27, 2016 22:29 — forked from lavoiesl/before.rules
Rate limit HTTP requests using UFW
### Add those lines after *filter near the beginning of the file
:ufw-http - [0:0]
:ufw-http-logdrop - [0:0]
### Add those lines near the end of the file
### Start HTTP ###
@jonathanccalixto
jonathanccalixto / radio.shim.js
Created June 5, 2016 00:44
A shim to replace Backbone.Wreqr with Backbone.Radio in Marionette. Requires Marionette v2.1+
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['backbone.marionette', 'backbone.radio', 'underscore'], function(Marionette, Radio, _) {
return factory(Marionette, Radio, _);
});
}
else if (typeof exports !== 'undefined') {
var Marionette = require('backbone.marionette');
var Radio = require('backbone.radio');
var _ = require('underscore');
#!/bin/bash
set -e
set -x
provision_command="wget -O- https://gist.github.com/sobrinho/4774041 | sh"
ssh root@server1 "$provision_command"
ssh root@server2 "$provision_command"

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# .railsrc for Rails 3, encoding: utf-8
# see http://rbjl.net/49-railsrc-rails-console-snippets
if !Rails.application then warn "Rails isn't loaded, yet... skipping .railsrc" else
# # #
def ripl?; defined?(Ripl) && Ripl.instance_variable_get(:@shell); end
# # #
# loggers