Skip to content

Instantly share code, notes, and snippets.

@onwsk8r
onwsk8r / gist:c55723b1523ada964c1fd2d212cc4555
Created March 15, 2022 10:51
Terraform mutating_webhook_configuration fail
❯ TF_LOG=trace terraform apply
2022-03-15T05:48:58.566-0500 [INFO] Terraform version: 1.1.7
2022-03-15T05:48:58.566-0500 [INFO] Go runtime version: go1.17.2
2022-03-15T05:48:58.566-0500 [INFO] CLI args: []string{"/home/brian/.tfenv/versions/1.1.7/terraform", "apply"}
2022-03-15T05:48:58.566-0500 [TRACE] Stdout is a terminal of width 160
2022-03-15T05:48:58.566-0500 [TRACE] Stderr is a terminal of width 160
2022-03-15T05:48:58.566-0500 [TRACE] Stdin is a terminal
2022-03-15T05:48:58.566-0500 [DEBUG] Attempting to open CLI config file: /home/brian/.terraformrc
2022-03-15T05:48:58.566-0500 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-03-15T05:48:58.566-0500 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
@onwsk8r
onwsk8r / 8to7.go
Last active September 24, 2019 14:52
Convert 7bit ASCII to 8bit ASCII
import (
"encoding/binary"
"io"
)
// Convert changes 7-bit ASCII to 8-bit ASCII.
// Given 56 bits of input, there are 8x 7-bit characters contained
// in the bits, but Go cannot extract the ASCII text from the input
// because the smallest unit of data in Go is the byte. This function
// will convert each group of 7 bits into an 8-bit byte, which can be
@onwsk8r
onwsk8r / slow-queries.sql
Created August 16, 2019 18:28
Find Slow Queries in MySQL
-- Some relevant tables:
use sys;
show tables like 'statements_with%'; -- and views
-- Results: statements_with_{errors_or_warnings,full_table_scans,runtimes_in_95th_percentile,sorting,temp_tables}
-- Raw (ie not human readable) views in sys start with x$, but are necessary for sorting
-- Slow queries
SELECT schema_name, total_latency, exec_count, query_sample_text
FROM sys.x$satements_with_runtimes_in_95th_percentile
@onwsk8r
onwsk8r / apiclient_slash_client.go
Created July 16, 2019 17:25
Example API Client implementation
/*package apiclient provides an API client*/
package apiclient
import (
"bytes"
"context"
"fmt"
"io"
"net/http"
"net/url"
### Keybase proof
I hereby claim:
* I am onwsk8r on github.
* I am onwsk8r (https://keybase.io/onwsk8r) on keybase.
* I have a public key ASCAsOljox5BpCoG-DYZsBDXpFcnwilI_K3VDxaJO73H2go
To claim this, I am signing this object:
execve("/usr/bin/mongodb-compass", ["mongodb-compass"], 0x7ffc24a0ab60 /* 48 vars */) = 0
brk(NULL) = 0x5a03000
readlink("/proc/self/exe", "/usr/share/mongodb-compass/Mongo"..., 4096) = 42
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa985176000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/mongodb-compass/tls/x86_64/x86_64/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/share/mongodb-compass/tls/x86_64/x86_64", 0x7ffc0bb6c350) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/mongodb-compass/tls/x86_64/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/share/mongodb-compass/tls/x86_64", 0x7ffc0bb6c350) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/mongodb-compass/tls/x86_64/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
execve("/usr/bin/soffice", ["soffice", "--calc"], 0x7ffc5b3b6408 /* 48 vars */) = 0
brk(NULL) = 0x1e41000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=179200, ...}) = 0
mmap(NULL, 179200, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7eff07a000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libreadline.so.7", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0n\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0555, st_size=363064, ...}) = 0
@onwsk8r
onwsk8r / gist:6e9f6952caff275f0088a3dae62f8226
Created January 6, 2018 19:14
strace pgadmin4 &> out.log
execve("/usr/bin/pgadmin4", ["pgadmin4"], 0x7fffb742f9f0 /* 48 vars */) = 0
brk(NULL) = 0x2678000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=179200, ...}) = 0
mmap(NULL, 179200, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb746e07000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libreadline.so.7", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0n\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0555, st_size=363064, ...}) = 0