Skip to content

Instantly share code, notes, and snippets.

View mateothegreat's full-sized avatar
🤘
Building a freak show on kubernetes..

Matthew Davis mateothegreat

🤘
Building a freak show on kubernetes..
View GitHub Profile
# Oh My Posh YAML configuration equivalent of the provided JSONC config.
# This YAML is structured to match the JSONC config as closely as possible.
# For more information on Oh My Posh YAML schema, see:
# https://ohmyposh.dev/docs/config-schema
$schema: "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"
version: 3
console_title_template: "{{ .Folder }}"
final_space: true
# Transient Prompt Variables Documentation
#

Popover

Highly customizable floating overlay component with trigger and content atoms. Supports animations via usal and optional portals for rendering outside normal DOM flow.

[!NOTE] This component is a work in progress and is not yet ready for production.

@mateothegreat
mateothegreat / *
Created August 9, 2024 01:21
Kubernetes infra stack
‎‎​
@mateothegreat
mateothegreat / wait.go
Created August 3, 2024 21:07
Wait for multiple conditions for kubernetes client-go.
// WaitForResourceCondition waits for a condition to be met for each resource in the list of arguments.
//
// Arguments:
// - args ...WaitForResourceConditionArgs: a list of arguments to wait for a condition to be met for each resource.
//
// Returns:
// - []error: a list of errors, one for each resource.
func WaitForResourceCondition(args ...WaitForResourceConditionArgs) []error {
var wg sync.WaitGroup
var mu sync.Mutex
@mateothegreat
mateothegreat / ExampleController.ts
Last active July 20, 2023 07:04
Request authorization with nest.js + JWT
@Controller("/foo")
export class SomeController {
@Get("/thisisprotected")
@UseGuards(RequestGuard)
public search(@SessionDecorator() session: Session): Promise<any> {
return { foo: "bar" };
}
}
@mateothegreat
mateothegreat / GlobalExceptionHandler.ts
Created June 21, 2023 17:08
nest.js exception filtering
import { ArgumentsHost, Catch, ConflictException, ExceptionFilter } from '@nestjs/common';
@Catch()
export class GlobalExceptionsFilter implements ExceptionFilter {
public catch(exception: any, host: ArgumentsHost): void {
// const log = {
// date: new Date(),
// source: request.ip,
// url: request.url,
// method: request.method,
@mateothegreat
mateothegreat / capture-browser-screenshot.js
Created April 20, 2023 17:56
Capture a screenshot in the browser
function getDisplayMedia(options) {
if (navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
return navigator.mediaDevices.getDisplayMedia(options)
}
if (navigator.getDisplayMedia) {
return navigator.getDisplayMedia(options)
}
if (navigator.webkitGetDisplayMedia) {
return navigator.webkitGetDisplayMedia(options)
}
@mateothegreat
mateothegreat / benchmark_test.go
Created April 17, 2023 19:10
Slices vs. Array performance in golang.
package main
import "testing"
var gs = make([]byte, 1000)
var ga [1000]byte
func BenchmarkSliceGlobal(b *testing.B) {
for i := 0; i < b.N; i++ {
for j, v := range gs {

Keybase proof

I hereby claim:

  • I am mateothegreat on github.
  • I am matthewbdavis (https://keybase.io/matthewbdavis) on keybase.
  • I have a public key ASAehsbCoBdkPerCbsKs-2rt3NgU_OawJs4HxthGhWMZigo

To claim this, I am signing this object:

@mateothegreat
mateothegreat / ansible.cfg
Created April 25, 2020 20:35
ansible configuration for speed
[defaults]
host_key_checking = False
retry_files_enabled = False
ansible_python_interpreter=python3
localhost_warning = False
strategy_plugins = plugins/mitogen-0.2.9/ansible_mitogen/plugins/strategy
strategy = mitogen_linear
callback_whitelist = timer, profile_tasks
forks = 50
internal_poll_interval = 0.001