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 / install_docker.sh
Created February 3, 2021 17:05
Install docker for Linux like a Debian
# Donwloads project
echo "\033[0;32m## Installing \033[1;34mdocker dependecies\033[0;37;00m"
sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
echo "\033[0;32m## Adding \033[1;34mdocker gpg key\033[0;37;00m"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -f -
sudo apt-key fingerprint 0EBFCD88
echo "\033[0;32m## Adding \033[1;34mdocker respository\033[0;37;00m"
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
@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 / 01_sponsor.rb
Last active November 16, 2016 16:37
Criando um FormFilter no rails
# Este aquivo fica em app/models/sponsor.rb
class Sponsor < ActiveRecord::Base
# aqui fica meu codigo e scopes
end
require 'active_support/all'
class FreeleticsLogin
def self.log(*args)
new(*args).log
end
def initialize(email, password)
self.login_url = 'https://www.freeletics.com/api/user/v1/auth/password/login'
self.email = email
@jonathanccalixto
jonathanccalixto / countries.rb
Last active October 3, 2016 19:57
Evobinary members report
File.open("#{Rails.root}/public/countries.txt", 'w') do |file|
countries = []
Country.all.each do |country|
next if country.sponsors.count.zero?
countries << [country.sponsors.count, country.to_s]
end.nil?
file.puts "=" * 100
class CreateProfiles < ActiveRecord::Migration
def change
create_table :profiles do |t|
t.string :name
t.timestamps null: false
t.index :name
end
end
end