- Detect secrets in code
- Identify secrets committed to version control
- Flag hardcoded credentials
- Identify missing authentication checks
- Detect improper authorization patterns
| class Node | |
| attr_accessor :children, :size | |
| def initialize | |
| @children = {} | |
| @size = 0 | |
| end | |
| def find_count(word, index) | |
| return @size if index == word.length |
| # Running rethinkdb from docker | |
| docker run --name whatever-chido-name -v "$PWD:/data" -d rethinkdb | |
| # Build the docker image with the go app | |
| docker build -t compa . | |
| # This will start the previous container and will link | |
| # the two containers to communicate from each other | |
| docker run --name mi-compa-running -p 8000:8000 --link elated_bassi -d compa |
Slice an array
arr_new = arr_new.slice(0, len - 1)
Insert a new item at the begginning of the array
arr_new.unshift(last_item)
Find number of occurrences of a substring in a string
| require 'mail' | |
| require 'thread' | |
| require 'parallel' | |
| require 'benchmark' | |
| Mail.defaults do | |
| delivery_method :smtp, options | |
| end |
| class FailingWorker < Processable::Base | |
| include Processable::HandlerRetries | |
| sidekiq_retries_exhausted do |msg| | |
| handle_retries_exhausted(msg) | |
| end | |
| def self.handle_retries_exhausted(msg) | |
| p "===========================Failed #{msg['class']} with #{msg['args']}: #{msg['error_message']}************************" |
| require 'rake' | |
| MyRailsApp::Application.load_tasks # <-- MISSING LINE | |
| Rake::Task['my_task'].invoke |
| # whenever you need to do a custom query/function/sproc into another DB that is not development | |
| app = ActiveRecord::Base.establish_connection( | |
| adapter: "mysql", | |
| host: "localhost", | |
| username: "myuser", | |
| password: "mypass", | |
| database: "somedatabase" | |
| ) | |
| # if you have already defined an entry in database.yml | |
| # -------------- READ THIS TOO --------------------------------- |
| defmodule Ph_14Version.Field do | |
| use Ph_14Version.Web, :model | |
| use Ecto.Model.Callbacks | |
| before_insert :set_map_coords | |
| schema "fields" do | |
| field :name, :string | |
| field :map_coords, Geo.MultiPolygon |
| class TestsController < ApplicationController | |
| before_filter :execute_me, :only => :index | |
| def index | |
| @my_var2 = translate_me('ES', @my_var) | |
| end | |
| private | |
| def execute_me |