Skip to content

Instantly share code, notes, and snippets.

View stand-sure's full-sized avatar

Christopher J. Anderson stand-sure

View GitHub Profile
@stand-sure
stand-sure / console_1.sql
Created February 5, 2025 14:32
Get user privileges postgres
SELECT u.usename AS username,
c.relname,
n.nspname,
pg_catalog.pg_table_is_visible(c.oid) as table_name,
has_table_privilege(c.oid, 'SELECT') as select_access,
has_table_privilege(c.oid, 'INSERT') as insert_access,
has_table_privilege(c.oid, 'UPDATE') as update_access,
has_table_privilege(c.oid, 'DELETE') as delete_access
FROM pg_catalog.pg_user u
CROSS JOIN pg_catalog.pg_class c
@stand-sure
stand-sure / deno.json
Created January 17, 2025 15:49
Deno script for getting timezone from address
{
"tasks": {
"dev": "deno run --watch main.ts"
},
"imports": {
"@googlemaps/google-maps-services-js": "npm:@googlemaps/google-maps-services-js@^3.4.0",
"@std/assert": "jsr:@std/assert@1",
"@types/node": "npm:@types/node@^22.10.7"
}
}
internal class RowVersionInterceptor : SaveChangesInterceptor
{
public override InterceptionResult<int> SavingChanges(DbContextEventData eventData, InterceptionResult<int> result)
{
DbContext dbContext = eventData.Context!;
foreach (EntityEntry entry in dbContext.ChangeTracker.Entries().Where(e => e.State is EntityState.Added or EntityState.Modified))
{
IEnumerable<PropertyEntry> concurrencyTokens = entry.Properties.Where(p => p.Metadata.IsConcurrencyToken);
@stand-sure
stand-sure / README.md
Created May 3, 2024 14:35
How to spin up a redis cli troubleshooting pod

This is for troubleshooting/fixing redis that is already running or failing to start.

Scheduling the pod on the same node

This is necessary because the PVC is RW once

  affinity:
    podAffinity:
 requiredDuringSchedulingIgnoredDuringExecution:
@stand-sure
stand-sure / .pre-commit-config.yaml
Created April 12, 2024 17:58
Preventing commits to the default branch with pre-commit
repos:
- repo: local
hooks:
- id: prevent-commits-to-default-branch
name: prevent commits to default branch
entry: prevent-commits-to-default-branch.sh
language: script
require_serial: true
@stand-sure
stand-sure / Client.csproj
Last active March 22, 2024 17:01
How to generate a populated OpenAPI spec for .net8 minimal API and hot to generate a client using Kiota
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Demos.OAS.Client</RootNamespace>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<FileVersion>0.1.0.0</FileVersion>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.1.0</Version>
@stand-sure
stand-sure / remove-finalizers.sh
Created March 14, 2024 14:52
remove finalizer for all items of a certain kind
kubectl get REPLACE_WITH_KIND -o name | xargs -n1 kubectl patch --type merge --patch '{"metadata":{"finalizers":null}}'
@stand-sure
stand-sure / README.md
Created March 5, 2024 19:24
Kube Stack Prometheus Grafana Datasource with Secrets

Grafana Datasource with Secrets

  1. Create a secret
  2. Add the secrets as environment variables to the Grafana section of the Prometheus yaml
  3. Use the environment values (secureJsonData)
@stand-sure
stand-sure / README.md
Created February 28, 2024 20:39
Clickhouse & Jaeger

jaeger-config.yaml

Set values for address, username, and password.

Make the password into a hash for the clickhouse installation.

printf `printf 'my-password' | sha256sum` ; echo

# 6fa2288c361becce3e30ba4c41be7d8ba01e3580566f7acc76a7f99994474c46