Skip to content

Instantly share code, notes, and snippets.

@phinze
phinze / brew-cask.rb
Created March 10, 2012 07:57
a homebrew formula for installing brew-cask
require 'formula'
class BrewCask < Formula
homepage 'https://github.com/phinze/brew-cask/'
head 'https://github.com/phinze/brew-cask.git'
skip_clean :all
def install
@phinze
phinze / teams-to-workspaces.tf
Last active June 21, 2022 04:23
An example of how you could map teams to many workspaces using the Terraform Enterprise provider
# Start w/ a data source to get a list of all the workspaces
# See: https://www.terraform.io/docs/providers/tfe/d/workspace_ids.html
data "tfe_workspace_ids" "all-workspaces" {
names = ["*"]
organization = "my-org-name"
}
# Look up the ID of the teamn you're looking to map
# See: https://www.terraform.io/docs/providers/tfe/d/team.html
data "tfe_team" "architects" {
@phinze
phinze / main.tf.js
Last active June 14, 2021 23:20
Terraform Example: ebs_block_device that remains after instance termination
resource "aws_instance" "web" {
ami = "ami-7f89a64f"
instance_type = "t1.micro"
ebs_block_device {
device_name = "/dev/sdg"
volume_size = 5
volume_type = "gp2"
delete_on_termination = false
}
}
@phinze
phinze / gist:5323078
Created April 5, 2013 22:12
delete all files in a folder with applescript ouch my eyezzzzzzzz
tell application "Finder"
set the appfiles to files in folder (POSIX file "/tmp/somefolder" as text)
repeat with appfile in appfiles
delete appfile
end repeat
end tell
@phinze
phinze / clear-dock.sh
Created January 18, 2020 23:41
Remove all persistent apps from the macos dock
dockutil --list | grep persistent-apps | cut -d $'\t' -f1 | while read thing; do dockutil --remove "${thing}"; done
@phinze
phinze / terraform_dot_workspace_workaround.tf
Created September 23, 2019 19:59
Untested sketch of a workaround for terraform.workspace not resolving in Terraform Cloud.
variable "org" {}
data "tfe_workspace_ids" "all" {
names = ["*"]
organization = var.org
}
resource "tfe_variable" "workspace_name" {
for_each = tfe_workspace_ids.all.*.id
workspace = this.key
@phinze
phinze / ennuigi.txt
Created November 17, 2017 23:22
All the reflections from Ennuigi https://www.lexaloffle.com/bbs/?tid=2232
am i...hungry?
no, not hungry. i should
eat something, but i'm
not hungry at all.
---
when did i eat last?
@phinze
phinze / main.scpt
Created January 24, 2014 15:28
iOS7 Screensaver Installer AppleScript
set source to ((path to me) as string) & "Contents:Resources:iOS 7 lockscreen by bodysoulspirit.qtz"
set mylib to (path to library folder from user domain) as string
set receiver to "Screen Savers"
tell application "Finder"
activate
@phinze
phinze / remove_casks_linked_as_formula.sh
Created August 6, 2013 23:44
Clean Casks from homebrew-casks that were improperly linked as homebrew formula during a brew update. This happened for a spell due to a bug in homebrew that is now fixed, but some people have extra links lying around from when the bug was in the wild. This has been tested and cleans up any symlinks that shouldn't be there.
find $(brew --prefix)/Library/Formula -type l | for symlink in $(cat -); do readlink $symlink | grep phinze-cask | grep -v brew-cask > /dev/null && rm -v $symlink; done