Skip to content

Instantly share code, notes, and snippets.

View jaymcgrath's full-sized avatar
😅

Jay McGrath jaymcgrath

😅
View GitHub Profile
@jaymcgrath
jaymcgrath / newrelic-terraform-local.md
Last active November 9, 2020 01:53
Building and installing newrelic terraform provider locally (macOS)

Versions.tf:

terraform {
  required_providers {
    newrelic = {
      version = "~> 99.0.0"
      source = "newrelic/newrelic"
    }
  }
 required_version = ">= 0.13"

Keybase proof

I hereby claim:

  • I am jaymcgrath on github.
  • I am jaymcgrath (https://keybase.io/jaymcgrath) on keybase.
  • I have a public key ASDOI9_Y7MozM5HoVFgxngNVEsIA-MyIuUKAPSIjYU3J3Qo

To claim this, I am signing this object:

# note - excludes __ and _ items
['author',
'contributors',
'coordinates',
'created_at',
'destroy',
'entities',
'favorite',
'favorite_count',
'favorited',
@jaymcgrath
jaymcgrath / Microsoft.Powershell_profile.ps1
Created January 5, 2017 22:02
Microsoft powershell aliases for easily switching between virtualenvs
$path_to_my_envs = "CHANGE ME" # <-- Change this to the windows system path to your virtualenvs. Mine is "C:\users\jaymcgrath\git\envs\"
# Each env should be named in the format "llama_env"
# For example, issuing the command "env llama" would activate the virtualenv at $path_to_my_envs + "llama_env"
function Activate-Env {
$envname = $args[0]
$commandstr = $path_to_my_envs + $envname + "_env\scripts\activate.ps1"
& $commandstr
}
@jaymcgrath
jaymcgrath / gist:f0d2a5756992ebde1778f27ea2d101a3
Last active December 25, 2016 18:23
Fizzbuzz as a list comprehension
[str(x) * int(bool(x % 3 and x % 5)) + "Fizz" * int(not bool(x % 3)) + "Buzz" * int(not bool(x % 5)) for x in range(1,101)]
# works, but could probably be condensed
# Condensed version, non list comp
for i in range(1,101):print('Fizz'*(0==i%3)+'Buzz'*(0==i%5)or i)
refactored as a list comp:
['Fizz'*(0==i%3)+'Buzz'*(0==i%5)or i for i in range(1,101)]
@jaymcgrath
jaymcgrath / chickens_rabbits.py
Created October 28, 2016 18:05
Solving Chinese Puzzle of Rabbits and Chickens with a list comprehension in Python
"""
Given a farm with rabbits and chickens, you count 35 heads and 94 legs. How many of each animal do you have?
Assume all rabbits and chickens have 4 and 2 legs respectively.
"""
from itertools import combinations_with_replacement
print([x for x in combinations_with_replacement([2,4],35) if sum(x) == 94])