Skip to content

Instantly share code, notes, and snippets.

@Carpetfizz
Carpetfizz / # gazebo8 - 2019-05-28_06-44-45.txt
Created May 28, 2019 14:03
gazebo8 (osrf/simulation/gazebo8) on macOS 10.14.5 - Homebrew build logs
Homebrew build logs for osrf/simulation/gazebo8 on macOS 10.14.5
Build date: 2019-05-28 06:44:45
@Carpetfizz
Carpetfizz / __init__.py
Created April 22, 2018 23:33
pytsp fixed
import numpy as np
import subprocess
import os
import math
template = """NAME: {name}
TYPE: TSP
COMMENT: {name}
DIMENSION: {n_cities}
EDGE_WEIGHT_TYPE: EXPLICIT
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :current_user
def authenticate
redirect_to :login unless user_signed_in?
end
def current_user
<% if current_user %>
<% current_user.attributes.each do |k, v| %>
<b><%= k %>:</b> <%= v %> <br>
<% end %>
<% end %>
<h1> Welcome, please login to continue </h1>
<a href="/auth/google_oauth2">Sign in with Google</a>
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :current_user
def authenticate
redirect_to :login unless user_signed_in?
end
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
class MeController < ApplicationController
before_action :authenticate
def show
end
end
class HomeController < ApplicationController
def show
end
end
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, "GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET"
end
Rails.application.routes.draw do
get 'login', to: redirect('/auth/google_oauth2'), as: 'login'
get 'logout', to: 'sessions#destroy', as: 'logout'
get 'auth/:provider/callback', to: 'sessions#create'
get 'auth/failure', to: redirect('/')
get 'home', to: 'home#show'
get 'me', to: 'me#show', as: 'me'
root to: "home#show"