Skip to content

Instantly share code, notes, and snippets.

Darren Jensen jensendarren

View GitHub Profile
@jensendarren
jensendarren / update-keypair-in-ec2.md
Last active Feb 19, 2020
Add new SSH Keypair to an EC2 instance when you have lost your .pem file!
View update-keypair-in-ec2.md

How to update your EC2 instance with a new keypair

  1. Create a new keypair in AWS Console

  2. Start a new temporary recovery EC2 instance

  3. Stop the lost keypair instance

  4. Detach the EBS drive from the lost keypair instance

@jensendarren
jensendarren / App.vue
Last active Feb 25, 2020
A VueJS Prototype for logging console output to the component
View App.vue
<!--Make sure to install @vue/cli-service-global first-->
<!--Serve this up using `vue serve` at the command line-->
<!--Details here: https://cli.vuejs.org/guide/prototyping.html -->
<template>
<div>
<h1>{{name}}</h1>
<b>Logging To Vue Component? <span>{{logging}}</span></b>
<br />
<button @click="testLog">Test Log</button>|<button @click="testWarn">Test Warn</button>|<button @click="toggleLogging">Toggle Logging</button>
<hr/>
@jensendarren
jensendarren / VueJS Rapid Prototyping Example
Created Feb 11, 2020
A basic VueJS Rapid Prototyping Example
View VueJS Rapid Prototyping Example
<!--Make sure to install @vue/cli-service-global first-->
<!--Serve this up using `vue serve` at the command line-->
<!--Details here: https://cli.vuejs.org/guide/prototyping.html -->
<template>
<h1>Hello {{name}}</h1>
</template>
<script>
export default {
data() {
View keybase.md

Keybase proof

I hereby claim:

  • I am jensendarren on github.
  • I am jensendarren (https://keybase.io/jensendarren) on keybase.
  • I have a public key ASCUxtscnfGIjSlMCwIboYoEa2sGTmteWlwklL9PgF72xAo

To claim this, I am signing this object:

@jensendarren
jensendarren / bashrc
Created Jul 27, 2015
Add git alias to your terminal command set
View bashrc
# Add this to your ~/.bashrc file then run `source ~/.bashrc`
alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gd='git diff'
alias gg='git grep -i'
alias go='git checkout '
@jensendarren
jensendarren / gist:e5614e19db0dcf96fa44
Created Jul 9, 2015
Git diff which includes new files
View gist:e5614e19db0dcf96fa44
if test "$#" = 0; then
(
git diff
git ls-files --others --exclude-standard |
while read -r i; do git diff -- /dev/null "$i"; done
)
else
git diff "$@"
fi
@jensendarren
jensendarren / uri_example.rb
Created Jan 8, 2015
An example of using URI in Ruby
View uri_example.rb
require 'uri'
require 'open-uri'
google_url = "http://google.com/"
url = URI.parse(google_url)
# Get the hostname
puts "The hostname is #{url.hostname}"
@jensendarren
jensendarren / optparse_example.rb
Created Jan 8, 2015
An example of using OptionParser in Ruby
View optparse_example.rb
# Restrict arguments to a specified class.
require 'optparse'
class HelloParser
def self.parse(args)
options = {}
opts = OptionParser.new do |opts|
opts.banner = "Usage: name"
opts.on('-n', '--name NAME', 'The name of the person to say hello to') do |name|
@jensendarren
jensendarren / logger_example_stdout.rb
Created Jan 8, 2015
An example of using STDOUT Logger in Ruby
View logger_example_stdout.rb
# http://www.ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html
require 'logger'
class CoffeeShop
attr_reader :logger
def initialize(name)
@name = name
@menu = []
@logger = Logger.new(STDOUT)
@jensendarren
jensendarren / logger_file_example.rb
Created Jan 8, 2015
An example of using a file Logger in Ruby
View logger_file_example.rb
require 'logger'
class CoffeeShop
attr_reader :std_logger, :file_logger
def initialize(name)
@name = name
@menu = []
@std_logger = Logger.new(STDOUT)
@file_logger = Logger.new('./coffee_shop.log')
You can’t perform that action at this time.