Skip to content

Instantly share code, notes, and snippets.

Evan Reeves JadedEvan

Block or report user

Report or block JadedEvan

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
@JadedEvan
JadedEvan / git-merge-single-file.sh
Last active Oct 21, 2016
How to revert a file to a known working state and apply upstream changes in a patch from a different branch.
View git-merge-single-file.sh
# Check out the original file should receive the changes. This should be the version on your working branch
git checkout {MY-WORKING-BRANCH-SHA} -- path/to/my/file.txt
# Generate a diff of the file, ignoring space changes against a known branch. You should be on your working branch for this
git checkout my-working-branch
git diff HEAD..master --ignore-space-change -- path/to/my/file.txt > patch.diff
# Apply the patch. Note that you MUST use the same --ignore-space-change flag to apply properly
git apply --ignore-space-change patch.diff
@JadedEvan
JadedEvan / cloudformation-gnip-kinesis-connector.json
Created Jul 16, 2015
Amazon CloudFormation script to create a new EC2 server that runs the GNIP "sample-kinesis-connector" java application. This can be used to read incoming data from GNIP stream and push it over to Amazon Kinesis. GNIP pulled support for the Public AMI in the Amazon Marketplace, so here's one that will take you most of the way.
View cloudformation-gnip-kinesis-connector.json
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description": "Create EC2 instance to run a GNIP Kinesis connector. Creates CloudWatch alarms when 85% stream capacity reached.",
"Parameters" : {
"Environment" : {
"Type": "String",
"Description": "Environment in which to run",
"AllowedValues": ["production", "development"]
},
"InstanceTerminationProtection": {
@JadedEvan
JadedEvan / TUTORIAL-ruby-instance-methods-versus-attribute-accessors.md
Last active Jul 20, 2016
An article highlighting the difference in using instance methods over attribute accessors in Ruby classes. A fundamental concept that is often overlooked by beginner and intermediate Rubyists that can lead to cleaner, more predictable code
View TUTORIAL-ruby-instance-methods-versus-attribute-accessors.md

Ruby Design Patterns - Methods over Attributes

Overview

The objective of this article is to highlight the subtle differences between using class attributes and class methods in Ruby. Both offer a valid way to manipulate the state of an instance of a class. Things can get increasingly complex, hard to test and hard to maintain as more instance variables are introduced. Beginner and intermediate Rubyists often miss this subtle but important point which can introduce bugs that may be hard to fix in their native habitat.

The reasons I prefer to use methods over instance variables:

  • Increases predictability of method calls
  • Increases predictability when testing
@JadedEvan
JadedEvan / vagrant-sync-folders-fix.md
Last active Aug 29, 2015
How I resolved issues with my vagrant/Virtualbox not syncing folders from my host filesystem into my guest filesystem.
View vagrant-sync-folders-fix.md

Overview

After updating my Virtualbox installation I was experiencing issues with vagrant not syncing my shared folders from my Mac OS X host to the guest filesystem (Ubuntu). This document logs some of the steps that I used to fix that problem.

After booting my vagrant VM, none of the folders I had specified in the directory were syncing.

Software

  • Mac OS X 10.8.5 (Host)
  • Ubuntu 12.04 LTS (Guest)
@JadedEvan
JadedEvan / HOWTO-puppet-master-environment.md
Created Mar 30, 2015
HOWTO configure the puppet enterprise master (v3.7) to use environment directories
View HOWTO-puppet-master-environment.md

Overview

This document describes how to modify the Puppet Master (Enterprise v3.7) server configuration so that it can use environments for the manifests. Using those environment files allows the puppet agents to configure themselves in a variety of environments. It allows you to create a separate set of manifests and modules for specific environments, thereby safeguarding that untested modifications to no promote to the production nodes.

Setup environment directories

$ cd /etc/puppetlabs
$ sudo mkdir environments
$ sudo clown -r puppet:root environments
@JadedEvan
JadedEvan / HOWTO-openssl.md
Last active Mar 1, 2017
Various openssl commands
View HOWTO-openssl.md

Self Signed Certificate

Generate a new RSA key of 4096 bits. Adding the -des3 (or any other cipher) requires that the key have a password issued:

openssl genrsa -out server.key 2048

Generate a new CSR (Certificate Signed Request)

openssl req -new -key server.key -out server.csr
@JadedEvan
JadedEvan / git-branch-delete.sh
Created May 23, 2013
An interactive bash shell script to delete remote git branches
View git-branch-delete.sh
#!/bin/bash
# An interactive script that allows you to delete multiple remote branches from
# a git repository with confirmation before deletion.
#
# Provide the path to the git repo as an argument to the script or it will
# prompt you for the path to the repo
#
# @version 0.1
# @author Evan Reeves <develop@evanreeves.com>
@JadedEvan
JadedEvan / git-notes.mdown
Created Jul 25, 2012
Library of useful git commands
View git-notes.mdown

Git Notes

Merge Two Branches in seperate repos

I have two independent repositories (A and B) and would like to merge one repo. (B) into another one (A) with keeping the whole history of both. What do to?

% cd projectA
% git remote add test ../path/to/other/repo && git fetch test

Adds a new branch called test which pulls in ALL branches from the /other/repo. git fetch test pulls code for all branches

@JadedEvan
JadedEvan / unix-cli-tips.md
Last active May 25, 2018
UNIX Tips - a catalog of useful UNIX commands
View unix-cli-tips.md

find commands

find . -regextype posix-egrep -regex ".*(rb|js)$"

Find all files ending in .rb or .js.

find . -name "*js" -o -name "*rb"

Same as above, not using regular expressions.

@JadedEvan
JadedEvan / vim-notes.mdown
Created Sep 22, 2011
Vim Tips - a catalog of useful Vim commands
View vim-notes.mdown

Buffer Settings

:set scrolloffset=30
:set scrolloffset=999
:set so=0

Sets the offset when scrolling through a document. A value of 30 will keep a marginal amount of space while scrolling, a value of 999 will keep the cursor centered in the screen, a value of 0 restores Vim's default behavior. All of the above can be added to your ~/.vimrc file to set editor defaults. Vim wikia - scroll centering

Additional buffer settings

You can’t perform that action at this time.