Skip to content

Instantly share code, notes, and snippets.

View omenking's full-sized avatar
🏠
Working from home

Andrew Brown omenking

🏠
Working from home
View GitHub Profile
@omenking
omenking / gitpod_to_rds.rb
Created January 26, 2022 16:46
Gitpod to RDS
require 'aws-sdk-ec2'
require 'pry'
class GitpodToRds
def self.run sg_id:, ip_protocol:, from_port:, to_port:, description:, ip_address:
raise "ip address must not be blank" if ip_address.nil?
cidr_ip_range = "#{ip_address}/32"
client = GitpodToRds.ec2_client
sg = GitpodToRds.describe_security_group client: client, sg_id: sg_id
@omenking
omenking / gist:750029716ee9074eeb412bb379c4c324
Created February 27, 2021 15:04
AWS Support + CrossAccount CodeCommit Https Git Credentials in CodeBuild Project
I am attempting to install packages for NodeJS that reference a CodeCommit repository that resides in different AWS Account from a different AWS Organization.
I am receive the error "unable to access"
===========================
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my_package
npm ERR!
npm ERR! fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my_package/ ': The requested URL returned error: 403
===========================
mkdir test_video
cd test_video
ffmpeg -f lavfi -i testsrc=duration=3600:size=256x144:rate=24 t1.mpg
cp t1 t1.mpg
cp t1 t2.mpg
cp t1 t3.mpg
cp t1 t4.mpg
cp t1 t5.mpg
cp t1 t6.mpg
cp t1 t7.mpg
require "test/unit"
# remove the first and last letter of a string
# if there is less than 2 characters return zero.
def quartered value
raise ArgumentError, 'Argument is not a string' unless value.is_a? String
return value unless value.size > 2
value[0] = ''
value.chop
end
@omenking
omenking / Gemfile
Created June 13, 2019 03:03
003 - QA Mastery
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'rspec'
@omenking
omenking / hello_spec.rb
Created June 13, 2019 03:02
003 - QA Mastery
# spec/hello_spec.rb
require_relative '../hello'
RSpec.describe Hello do
context "#world" do
it { expect(Hello.world).to eql 'world' }
end
end
@omenking
omenking / Gemfile
Created June 13, 2019 02:59
002 - QA Mastery
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'minitest'
@omenking
omenking / hello_spec.rb
Created June 13, 2019 02:58
002 - QA Mastery
require 'minitest/autorun'
require_relative './hello'
describe Hello do
describe "#world" do
it "should return world" do
Hello.world.must_equal 'world'
end
end
end
@omenking
omenking / hello_test.rb
Created June 13, 2019 02:57
002 - QA Mastery
require 'minitest/autorun'
require_relative './hello'
class HelloTest < Minitest::Test
def test_world
assert_equal 'world', Hello.world, "Hello.world should return a string called 'world'"
end
def test_flunk
flunk "You shall not pass"
@omenking
omenking / simple.rb
Created June 13, 2019 02:38
001 - QA Mastery
require "test/unit/assertions"
include Test::Unit::Assertions
x = true
assert x, "x should pass"