header image

Code Snippets

render of code snippet

Backup libvirt Domains Using virtnbdbackup

Bash script to backup Libvirt domains using virtnbdbackup on cron
render of code snippet

Merge Git Repository as Subdirectory

Add a git respostory into an another git repository while keeping commit history
render of code snippet

Substitute Values in Files Using sed

Find files in directory recursively and substitute values using sed
render of code snippet

Targeted Firefox CSS

Apply CSS Rule To Firefox Only
render of code snippet

Dynamically select SSH or HTTPS in Gemfile git_source

If valid key added to `ssh-agent`, use SSH for custom Gemfile `git_source`, else fallback to HTTPS
render of code snippet

Set CSS `box-sizing` Property Globally

Change the default CSS `box-sizing` property value to help developer intuition
render of code snippet

Decrypt Rails v4.2 Session Cookie

Ruby script to decrypt and debug encrypted Rails cookies
render of code snippet

AWS S3 Public Permissions Policy

Basic public access policy for objects in AWS S3 bucket.
render of code snippet

Ruby on Rails Docker CMD Startup Script

Docker CMD startup script to create or migrate database then start the application server
render of code snippet

Check if Ruby On Rails Database Exists Using Rake

Rake task which uses ActiveRecord to check if Ruby on Rails database exists i.e. has been created and is accessible
render of code snippet

AWS S3 Open CORS Policy

Basic open Cross-origin resource sharing (CORS) policy for AWS S3 bucket
render of code snippet

Linux Directory Backup to AWS S3

Compress, encrypt, and backup a Linux directory to AWS S3 using cron.
render of code snippet

Mobile First Responsive Design Breakpoints SASS Mixin

SASS @mixin to add responsive design breakpoints to CSS rules
render of code snippet

Zsh - Auto Select Node Version

Automatically Select Nodejs Version in Zsh Shell Using 'n'
render of code snippet

Rails Human Friendly Resource URIs

Create Human Readable URIs for Ruby on Rails Models
render of code snippet

CircleCI Automerge Github PR

Automatically Merge Successful GitHub Pull Requests on CircleCI
render of code snippet

Travis-CI Auto-Deploy to Kubernetes

Automatically apply updated Kubernetes config to control plane using Travis-CI
render of code snippet

Travis-CI Docker Build and Publish

Automatically build and publish application container image to dockerhub using Travis-CI
render of code snippet

Travis-CI GitHub PR Automerge

Automatically merge successful GitHub pull requests on TravisCI
render of code snippet

Hello World

The classic