Skip to content

Instantly share code, notes, and snippets.

View displague's full-sized avatar
🐝
Mergin' 🎶 on a Sunday afternoon 🎶

Marques Johansson displague

🐝
Mergin' 🎶 on a Sunday afternoon 🎶
View GitHub Profile
@displague
displague / mssql_helper.php
Created July 26, 2012 03:56
PDO_SQLSRV wrapper for legacy MSSQL PHP database functions
<?php
if (! extension_loaded('mssql') && extension_loaded('pdo_sqlsrv')) {
//Return an associative array. Used on mssql_fetch_array()'s result_type parameter.
define('MSSQL_ASSOC', '1');
//Return an array with numeric keys. Used on mssql_fetch_array()'s result_type parameter.
define('MSSQL_NUM', '2');
//Return an array with both numeric keys and keys with their field name. This is the default value for mssql_fetch_array()'s result_type parameter.
@displague
displague / equinix_metal_port_vlan_attachment.md-1.13-1.14.diff
Last active October 24, 2023 23:14
Equinix Terraform 1.13 to 1.14 Schema changes
diff --git a/docs/resources/equinix_metal_port_vlan_attachment.md b/docs/resources/equinix_metal_port_vlan_attachment.md
index 7ccb5ea..ac60bb1 100644
--- a/docs/resources/equinix_metal_port_vlan_attachment.md
+++ b/docs/resources/equinix_metal_port_vlan_attachment.md
@@ -6,7 +6,7 @@ subcategory: "Metal"
Provides a resource to attach device ports to VLANs.
-Device and VLAN must be in the same facility.
+Device and VLAN must be in the same metro.
@displague
displague / tfacc.sh
Last active August 16, 2023 15:54
delete tfacc packet devices and projects
#!/usr/bin/env bash
CMD=metal
# METAL_ORGANIZATION_ID=(the one you want to clean), otherwise defaults to metal cli settings)
$CMD project get | \
awk '/\s*(tfacc|GHACTION|ansible)/ {print $2}' | \
while read proj; do
$CMD devices get -p $proj | \
awk '/tfacc|ansible|GHACTION/ {print $2}' | \
xargs -n1 $CMD device delete -f --id ;
$CMD project delete -f --id $proj ;
@displague
displague / qbr.sh
Last active August 2, 2023 20:49
QBR: GitHub releases over the past quarter (customize with your orgs and repos)
#!/usr/bin/env bash
quarters=${1:-0} # Modified this line to set quarters to 0
year=$(date +%Y)
month=$(date +%m)
quarter=$(((${month##0} - 1) / 3 + 1)) # trim leading zeros or invalid octals in August and September
quarter_patterns=(
[1]="0[1-3]" [2]="0[4-6]"
[3]="0[7-9]" [4]="1[0-2]"
)
all_patterns=""
$ find . -name go.mod | sed s/go.mod// | xargs -I{} sh -c 'cd {}; GOOS=linux golangci-lint run --path-prefix {} --fix ./...'
pkg/img/build.go:32:2: `defaultDockerRegistry` is unused (deadcode)
defaultDockerRegistry = "https://index.docker.io/v1/"
^
cmd/hub/cmd/generate.go:51:11: Error return value of `os.Mkdir` is not checked (errcheck)
os.Mkdir(generateOpts.output, 0700)
^
cmd/hub/main.go:10:19: Error return value of `logger.Sync` is not checked (errcheck)
defer logger.Sync() // flushes buffer, if any
^
#cloud-config
phone_home:
url: "http://tinkerbell.ewr1.packet.net/phone-home"
post:
- instance_id
tries: 5
autoinstall:
version: 1
# use interactive-sections to avoid an automatic reboot
#interactive-sections:
@displague
displague / README.md
Last active August 9, 2021 19:44
Use Equinix Metal with Juju

Juju already has knowledge of the Equinix Metal cloud, which means adding your Equinix Metal account to Juju is quick and easy.

More specific information on Juju's Equinix Metal support (e.g. the supported regions) can be seen locally or, since v.2.9.0, remotely (on a live cloud). Here, we'll show how to do it locally (client cache):

juju show-cloud --local equinix
@displague
displague / centos8-stream.ipxe
Last active May 27, 2021 13:34
CentOS 8 Stream via iPXE on Equinix Metal
#!ipxe
dhcp net0
# https://www.centos.org/download/mirrors/
set mirror http://mirror.pit.teraswitch.com
# x86_64, aarch_64, ppc64le
set arch x86_64
set path /centos/8-stream/BaseOS/x86_64/os
#!ipxe
dhcp net0
set release 4.7
set zstream 0
set arch x86_64
set ignition-url https://metadata.platformequinix.com/userdata
#set coreos-url https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/${release}/${release}.${zstream}