Skip to content

Instantly share code, notes, and snippets.

View robzr's full-sized avatar

Rob Zwissler robzr

View GitHub Profile
@robzr
robzr / gist:2abf9c7e7f576d8af00d90b671489b48
Created February 19, 2024 06:40
macOS Command Line to print power consumption, adapter wattage/profiles and power consumers
ioreg -w 0 -n AppleSmartBattery | \
jq -Rr '
select(
test("(AdapterDetails|AppleRawAdapterDetails|PowerOutDetails|PowerTelemetryData)")
)
| gsub("="; ":")
| gsub("\\("; "[")
| gsub("\\)"; "]")
| gsub(":(?<value>[^ ][A-Za-z]+)"; ": \"\(.value)\"")
| sub("^[^\"]*"; "")
@robzr
robzr / gist:75c193d73dddeed7e59a542c5365d0a4
Created October 1, 2021 17:34
Terraform block to dynamically determine project name & workspace from path
locals {
project = reverse([
for potential in [
for i in range(2, length(local.project_path_segments)) : {
git_root = join("/", slice(local.project_path_segments, 0, i + 1))
name = local.project_path_segments[i]
workspace = join(
"--",
slice(
local.project_path_segments,
@robzr
robzr / gist:d788a443f2b950f648fe1a2cedfb3f79
Created May 4, 2021 18:20
Terraform debug log demonstrating broken `base_rfc3339` attribute on `time_rotating` resource
2021-05-04T11:19:25.887-0700 [DEBUG] Adding temp file log sink: /var/folders/ks/qdjm0w8j2rn556v32lqqhqzc0000gn/T/terraform-log622136983
2021-05-04T11:19:25.887-0700 [INFO] Terraform version: 0.15.1
2021-05-04T11:19:25.887-0700 [INFO] Go runtime version: go1.16.3
2021-05-04T11:19:25.887-0700 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"}
2021-05-04T11:19:25.887-0700 [DEBUG] Attempting to open CLI config file: /Users/robzr/.terraformrc
2021-05-04T11:19:25.887-0700 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2021-05-04T11:19:25.887-0700 [DEBUG] checking for credentials in "/Users/robzr/.terraform.d/plugins"
2021-05-04T11:19:25.887-0700 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2021-05-04T11:19:25.887-0700 [DEBUG] will search for provider plugins in /Users/robzr/.terraform.d/plugins
2021-05-04T11:19:25.887-0700 [DEBUG] ignoring non-existing provider search directory /Users/robzr/Library/Application Support/io.terraform/plugins
@robzr
robzr / crash.log
Created March 18, 2020 02:21
HCL local referencing variable crash.log
2020/03/17 19:19:13 [INFO] Packer version: 1.5.4 [go1.13.8 darwin amd64]
2020/03/17 19:19:13 Checking 'PACKER_CONFIG' for a config file path
2020/03/17 19:19:13 'PACKER_CONFIG' not set; checking the default config file path
2020/03/17 19:19:13 Attempting to open config file: /Users/robzr/.packerconfig
2020/03/17 19:19:13 [WARN] Config file doesn't exist: /Users/robzr/.packerconfig
2020/03/17 19:19:13 Setting cache directory: /Users/robzr/github/ss_homework/packer/packer_cache
2020/03/17 19:19:13 waiting for all plugin processes to complete...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4a183d7]
@robzr
robzr / main.pkr.hcl
Last active March 18, 2020 02:20
Packer HCL file demonstrating local variable reference issue
variable "test" {
default = "default value" # Remove this line to cause Packer to crash
}
locals {
test = var.test
}
source "null" "null" {
communicator = "none"
@robzr
robzr / sequential_disk_benchmarking.md
Last active February 7, 2018 23:29
Sequential disk benchmarking on Linux with dd

Setup your benchmark parameters:

BM_FILE=./benchmark_data.$$
BM_SIZE=10 # in GB

Write the file:

sync &amp;&amp; echo 3 &gt; /proc/sys/vm/drop_caches &amp;&amp; dd if=/dev/zero of="$BM_FILE" bs=1G count=$BM_SIZE conv=fdatasync
### Keybase proof
I hereby claim:
* I am robzr on github.
* I am robzr (https://keybase.io/robzr) on keybase.
* I have a public key ASCSBL7tO1Ik0l1hpuHLZBje_f8qzXXeG65psOQr_mZZpgo
To claim this, I am signing this object:
@robzr
robzr / polycom_with_isc_dhcpd_classes.md
Last active May 17, 2023 08:46
Polycom VoIP phone provisioning using ISC DHCPD classes

Provisioning Polycom VoIP phones using ISC DHCPD

Using ISC DHCPD's concept of classes, we have a simple and powerful way of provisioning Polycom VoIP phones.

In the main body of the dhcpd.conf file (outside of any subnet declarations), we are going to define a couple custom Polycom options, then define the class, and match statements - which determine when the class is applied to DHCP clients. The class definition is also a good place to include some global options that will be applied to all Polycom clients, regardless of what subnet they end up on.

For the purposes of these examples, we're going to pretend our TFTP server is 10.0.1.2, and we are going to provision our phones to boot up on VLAN42 (10.0.42.0/24).

# Custom options used by Polycom clients

option polycom-vlan code 128 = text;

@robzr
robzr / keybase.md
Last active October 30, 2016 23:19
Keybase proof of ID for GitHub.

Keybase proof

I hereby claim:

  • I am robzr on github.
  • I am robzr (https://keybase.io/robzr) on keybase.
  • I have a public key whose fingerprint is E17F CAC7 4DFF 7918 1838 1192 D45B A6F6 5446 95A1

To claim this, I am signing this object: