Skip to content

Instantly share code, notes, and snippets.

@fmasuhr
fmasuhr / gist:4fd661b884f157590613
Last active June 27, 2022 03:25
Associate a Vagrant project directory with an existing VirtualBox VM
  1. Run the following command and copy the ID of your VM
VBoxManage list vms
=> "virtualMachine" {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
  1. Go to the Vagrant project configuration folder
@fmasuhr
fmasuhr / gist:8c3ae9932fac6db7afa1e9cd74435773
Created April 8, 2020 12:19
Git Interactive Rebase a fork

Sync a fork of a repository to keep it up-to-date with the upstream repository.

Inspired by the GitHub documentation

Fetch latest changes of the upstream repository.

git fetch upstream

Checkout the branch you want to sync the upstream into (Usually master).

@fmasuhr
fmasuhr / gist:585b97bad2a0b8c483f6857211122b13
Created June 6, 2019 15:11
Copy whole folder from AWS S3
aws s3 cp s3://<bucket>/<path>/ . --recursive --profile <profile>
@fmasuhr
fmasuhr / gist:a5ec1031d344330a5bdb94dd31aa99fc
Last active May 16, 2019 10:49
Listing teams of an organizations including their ID. This is using `jq` to map the result for better readability.
curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/orgs/<organization>/teams | jq '[.[] | {name: .name, id: .id}]'
@fmasuhr
fmasuhr / gist:e4b281b1860dda147ac3
Last active April 10, 2019 09:36
Get Node.js configuration for OpsWorks stacks
require 'aws-sdk-opsworks'
client = Aws::OpsWorks::Client.new(region: 'us-east-1')
stacks = client.describe_stacks.stacks
stacks.each do |stack|
custom_json = JSON.parse(stack.custom_json)
next unless custom_json['nodejs']
puts <<-END_OF_STRING
@fmasuhr
fmasuhr / gist:b8d561a61411ab80a0ad
Last active April 10, 2019 09:35
Get configuration for all "rails-app" OpsWorks Layer
require 'aws-sdk-opsworks'
client = Aws::OpsWorks::Client.new(region: 'us-east-1')
stacks = client.describe_stacks.stacks
layers = stacks.map { |stack| client.describe_layers(stack_id: stack.stack_id).layers }.compact
rails_app_layers = layers.detect { |layer| layer.shortname == 'rails-app' }
rails_app_layers.each do |layer|
stack = stacks.detect { |stack| stack.stack_id == layer.stack_id }
@fmasuhr
fmasuhr / gist:a3863994252175bf2fcc
Last active August 2, 2018 11:54
Add own labels to GitHub repository
require 'octokit'
LABELS = [{ name: 'almost ready to merge', color: 'bfe5bf' },
{ name: 'dependency missing', color: 'fbca04' },
{ name: 'do not merge', color: 'e11d21' },
{ name: 'ready to merge', color: '0e8a16' },
{ name: 'refactoring expected', color: 'fbca04' },
{ name: 'work in progress', color: 'fbca04' }]
repository = ARGV[0]
@fmasuhr
fmasuhr / gist:3ee4dd414d90765090188978e6bc7655
Last active July 18, 2018 09:40
Move Travis CI required_status_checks to new Github Application integration
require 'json'
require 'octokit'
require 'restclient'
ORGANIZATION = 'lessonnine'.freeze
ACCEPT_HEADER = 'application/vnd.github.luke-cage-preview+json'.freeze
Octokit.auto_paginate = true
client = Octokit::Client.new(access_token: ENV['GITHUB_ACCESS_TOKEN'])
@fmasuhr
fmasuhr / gist:da68ee59a2141f5b058d940de2ecc301
Created June 26, 2018 14:00
Vagrant up error: NFS is reporting that your exports file is invalid

When running vagrant up you might encounter the following error:

==> default: Exporting NFS shared folders...
NFS is reporting that your exports file is invalid. Vagrant does
this check before making any changes to the file. Please correct
the issues below and execute "vagrant reload":

exports:39: path contains non-directory or non-existent components: <any local path>
exports:39: no usable directories in export entry
@fmasuhr
fmasuhr / gist:6581808
Last active March 1, 2016 10:35
Store the passphrase for your default key in the Keychain. This will prevent you from entering this every time after a system restart.
# SSH key on OS X
ssh-add -K