Skip to content

Instantly share code, notes, and snippets.

💭
Travelling 🌴

Peter Mescalchin magnetikonline

💭
Travelling 🌴
Block or report user

Report or block magnetikonline

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@magnetikonline
magnetikonline / README.md
Last active Nov 21, 2019
List AWS AMI IDs for a given marketplace product.
View README.md

List AWS AMI IDs for a given marketplace product

Script to return AMI IDs for a given AWS region associated to a marketplace product page. Requires AWS CLI and a valid set of credentials for the aws ec2 describe-images call.

Usage

  • Browse the AWS marketplace to locate the product of interest.

  • Note the URL of the product page.

  • Execute script for the desired region:

     $ ./listmarketplaceami.sh ap-southeast-2 "https://aws.amazon.com/marketplace/pp/B00UU272MM"
@magnetikonline
magnetikonline / README.md
Last active Nov 20, 2019
Bash string manipulation cheatsheet.
View README.md

Bash string manipulation cheatsheet

Assignment
Assign value to variable if variable is not already set. Value will be returned.

Couple with : no-op if return value is to be discarded.
${variable="value"}
: ${variable="value"}
@magnetikonline
magnetikonline / README.md
Last active Nov 19, 2019
AWS clone VPC route table and routes.
View README.md

AWS clone VPC route table and routes

Python script to clone an existing VPC route table. Script output is a series of AWS CLI calls to create the route table and assign routes.

Update AWS_TARGET_REGION and SOURCE_ROUTE_TABLE_ID to suit.

Note: does not currently support NAT Gateways routes due to Boto 2 API limitation.

Example

$ ./clone-route-table.py
@magnetikonline
magnetikonline / README.md
Last active Nov 19, 2019
Responsive embedding of Google Maps (or anything <iframe> embedded really).
View README.md

Responsive Google Maps embedding

Simple technique for embedding Google Maps <iframe>'s responsively using a padding-bottom percentage trick, which when applied to a block element will be calculated as a percentage of the element width - essentially providing an aspect ratio.

This technique should work on anything that is <iframe> embedded from your social network/service of choice.

@magnetikonline
magnetikonline / README.md
Last active Nov 18, 2019
Node.js HTTP receiving request dump server.
View README.md

Node.js HTTP receiving request dump server

HTTP server which receives requests and dumps them to a flat file.

Usage

Start HTTP server:

$ nodejs ./httprequestdump.js
Listening on 0.0.0.0:8080
@magnetikonline
magnetikonline / README.md
Last active Nov 14, 2019
Add user ssh-agent as daemon to Ubuntu 18.04LTS server.
View README.md

Add user ssh-agent as daemon to Ubuntu 18.04LTS server

Create a new systemd user unit, which starts ssh-agent upon login to server. Will remain resident until the final session for the user has logged out.

Steps

  • Create /etc/systemd/user/ssh-agent.service.

  • Run the following commands (under your user account, not root) to install the systemd unit and start:

     $ systemctl --user enable ssh-agent.service
     $ systemctl --user start ssh-agent.service
@magnetikonline
magnetikonline / README.md
Last active Nov 12, 2019
Mac OS X - Install Git from source.
View README.md

Install Git on Mac OS X from source

A quick n' dirty bash script to install the following:

  • autoconf, needed by Git configure.
  • git - from source.

Requires as a minimum Xcode CLI tools (don't need a full Xcode install). Can be done via the following:

xcode-select --install
@magnetikonline
magnetikonline / README.md
Last active Nov 11, 2019
List all Git repository objects by size.
View README.md

List all Git repository objects by size

Summary

Bash script to:

  • Iterate all commits made within a Git repository.
  • List every object at each commit.
You can’t perform that action at this time.